trying to find out how to read a file in php..(fopen etc) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

trying to find out how to read a file in php..(fopen etc)

GoodGrendelGoodGrendel Posts: 61Member
hi, i'm sorta a newbee to PHP.

anyway, i have looked the net for a few minutes but i couldnt find something that solved my problem.

i'm trying to make a script wich reads lines of a file.

so far i tried the readf thingy, but someone told me you could use an array in order to get some specefic lines e.g $filename[0] would give the first line, though i couldnt find anything about that.

I would be verry happy if someone could push me a bit in the right direction, or give me a little example on how to do this.

Regards,
Ivo Jonker

Comments

  • iDaZeiDaZe Posts: 464Member
    : hi, i'm sorta a newbee to PHP.
    :
    : anyway, i have looked the net for a few minutes but i couldnt find something that solved my problem.
    :
    : i'm trying to make a script wich reads lines of a file.
    :
    : so far i tried the readf thingy, but someone told me you could use an array in order to get some specefic lines e.g $filename[0] would give the first line, though i couldnt find anything about that.
    :
    : I would be verry happy if someone could push me a bit in the right direction, or give me a little example on how to do this.
    :
    : Regards,
    : Ivo Jonker
    :

    [code]
    $myfile = file( $yourfilename );
    $i = 0;
    while ($i < length($myfile)) {
    $currentline = $myfile[$i];
    $i++;
    }
    [/code]

    you get tge idea ;-)

Sign In or Register to comment.