note 73504 deleted from function.file by bjori
| From: | bjori@php.net | Date: | Tue, 03 Apr 2007 11:51:16 +0000 |
| Subject: | note 73504 deleted from function.file by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125032@lists.php.net to get a copy of this message | ||
Note Submitter: Adria Kiev
----
There might be a little problem with \r\n in Windows files. It's often better to trim strings
before processing.
So modified example from the manual would be:
<?php
$strings = file('http://www.example.com/');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " .
htmlspecialchars(trim($line,"\r\n")) . "<br />\n";
}
// Another example
$html = implode('', file('http://www.ukraine-hotels.biz/'));
$html = str_replace("\r","",$html);
?>