note 44371 deleted from function.file-get-contents by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 04 Aug 2004 05:18:16 +0000 |
| Subject: | note 44371 deleted from function.file-get-contents by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73891@lists.php.net to get a copy of this message | ||
Note Submitter: prashar@uiuc.edu
----
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.