pelegk1
08-15-2005, 04:21 AM
how do u i read a file line by line and not at once?
thnaks i advance
peleg
thnaks i advance
peleg
|
Click to See Complete Forum and Search --> : read file line by line pelegk1 08-15-2005, 04:21 AM how do u i read a file line by line and not at once? thnaks i advance peleg ShrineDesigns 08-15-2005, 04:24 AM the closest thing i can think of is file() or<?php $data = implode('', file('foo.bar')); $data = preg_split("\r?\n?", $data); ?> bokeh 08-15-2005, 04:37 AM <?php $fp = fopen($file, "r+"); // open file while (!feof($fp)) { // while not end of file $line = fgets($fp, 4096); // get line (max 4096 bytes) // do something with $line } fclose($fp); // Close file ?> There are other functions too which can be used to move the file pointer to different parts of the file. 'r' and 'r+' start with the file pointer right at the start of the file. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |