Re: [php] file open

From: Date: Mon, 24 Mar 2003 12:48:40 +0000
Subject: Re: [php] file open
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-26594@lists.php.net to get a copy of this message
hello, i'm using the next code: $fp=fopen("WBSMUTA.CSV","r"); while (!(feof($fp))) {
        $data_file=fgets($fp,4096);
        echo "<br>$data_file<br>";
} to open a file... but I want to read it from line 3.. and there is a special function for, but can't find it back :( can someone tell me the name of this funcion? I know I can also use a counter into the while-loop, but I know there is a better sollution for.. thanks
The while loop is the way to solve it...don't know about an other solution... $lineNumber = 3; $txtnm = "WBSMUTA.CSV"; $txtnm = substr($txtnm, 0, -1); $fd = fopen ($txtnm, "r"); $i = 1; while (!feof($fd)) {
        // remove first 3 lines from file
        $lines = fgets($fd, 4096);
        if (!($i = $lineNumber)) {
                echo $lines . "<br>";
        }
        $i++;
} fclose ($fd);

« previous php.db (#26594) next »