note 28997 added to function.implode
| From: | metalblend at rack1 dot php dot net | Date: | Thu, 30 Jan 2003 00:54:50 +0000 |
| Subject: | note 28997 added to function.implode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43100@lists.php.net to get a copy of this message | ||
If you need to read an entire file into a string, you can use file() and implode() together:
function str_file($file) {
$str=implode("",file($file));
$str=str_replace("''","'",$str);
return $str;
}
syntax: $string=str_file("example.f");
There is an optional str_replace() because when I tried this at first it added an extra '
wherever it found ' .. this is a method that works for me.
Hope that helps someone out.
--
http://www.php.net/manual/en/function.implode.php
http://master.php.net/manage/user-notes.php?action=edit+28997
http://master.php.net/manage/user-notes.php?action=delete+28997
http://master.php.net/manage/user-notes.php?action=reject+28997