note 44371 added to function.file-get-contents
| From: | prashar at uiuc dot edu | Date: | Wed, 04 Aug 2004 01:58:22 +0000 |
| Subject: | note 44371 added to function.file-get-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-73885@lists.php.net to get a copy of this message | ||
I ran into issues using file_get_contents(), even though I'm running PHP 5.0. file() seems to
work, though, so I wrote my own flavor:
if (!function_exists('file_get_contents'))
{ function file_get_contents($url)
{ $array = file($url);
$size = count($array);
if ($size >= 0)
$string = $array[0];
for ($i = 1; $i < $size; $i++)
{ $string = $string . "\n" . $array[$i];
echo $array[$i];
}
return $string;
}
}
I know, the code's hackish and it leaves out the second parameter, but I blame needing the
function in a hurry.
----
Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44371
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44371&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44371&report=yes
Search -- http://master.php.net/manage/user-notes.php