Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.