note 73504 added to function.file
| From: | AdriaKiev at osu1 dot php dot net | Date: | Mon, 26 Feb 2007 21:21:12 +0000 |
| Subject: | note 73504 added to function.file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123907@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 195.248.191.91
Probable Submitter: 82.144.222.65 (proxied: 194.146.112.241)
----
Manual Page -- http://www.php.net/manual/en/function.file.php
Edit -- https://master.php.net/note/edit/73504
Del: integrated -- https://master.php.net/note/delete/73504/integrated
Del: useless -- https://master.php.net/note/delete/73504/useless
Del: bad code -- https://master.php.net/note/delete/73504/bad+code
Del: spam -- https://master.php.net/note/delete/73504/spam
Del: non-english -- https://master.php.net/note/delete/73504/non-english
Del: in docs -- https://master.php.net/note/delete/73504/in+docs
Del: other reasons-- https://master.php.net/note/delete/73504
Reject -- https://master.php.net/note/reject/73504
Search -- https://master.php.net/manage/user-notes.php