Re: Text Files

From: Date: Fri, 07 Mar 2003 23:27:53 +0000
Subject: Re: Text Files
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-26182@lists.php.net to get a copy of this message
I have a TXT file in witch I'd like to suppress a line. The number of the line is given How can I do ? Thanks for your help ;)
something like this should work $lineNumber = 10; $txtnm = "something.txt"; $txtnm = substr($txtnm, 0, -1); $fd = fopen ($txtnm, "r"); $i = 1; while (!feof($fd)) {
        // remove first 4 lines from file
        $lines = fgets($fd, 4096);
        if (!($i = $lineNumber)) {
                echo $lines . "<br>";
        }
        $i++;
} fclose ($fd);

« previous php.db (#26182) next »