note 61475 deleted from function.file-get-contents by tularis
| From: | tularis@php.net | Date: | Sat, 04 Feb 2006 18:12:35 +0000 |
| Subject: | note 61475 deleted from function.file-get-contents by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-103002@lists.php.net to get a copy of this message | ||
Note Submitter: Simon Riget at http://paragi.dk
Reason: useless
----
here is a simple example og how to use file_get_contents() to process a file of lines. (if you dont
want to use fopen)
<?
$file_data=file_get_contents('foo.txt');
if(!$file_data) exit("no file");
$ie=strpos($file_data,"\n");
$line=substr($file_data,0,$ie);
$is=$ie;
while($line){
// Process line here
echo $line;
$ie=strpos($file_data,"\n",$ie+1);
$line=substr($file_data,$is,$ie);
$is=$ie;
}
?>