note 47588 deleted from function.fgets by sean
| From: | sean@php.net | Date: | Mon, 22 Nov 2004 15:15:33 +0000 |
| Subject: | note 47588 deleted from function.fgets by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80870@lists.php.net to get a copy of this message | ||
Note Submitter: gnif at spacevs dot com
----
Reading the entire file in using fgetc is slow, here is a faster (and less bulky) alternative:
<?PHP
$delim = '|'
$text = file_get_contents('myfile.txt');
$items = explode($delim, $text);
?>
$content is now an array of each entry in the file, just itterate it, eg:
<?PHP
for ($i=0; $i<count($items); $i++) echo $items[$i];
?>
--
http://www.spacevs.com
----
Reason: useless note