note 28997 deleted from function.implode by sniper
| From: | sniper@php.net | Date: | Wed, 08 Oct 2003 03:54:39 +0000 |
| Subject: | note 28997 deleted from function.implode by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57995@lists.php.net to get a copy of this message | ||
Note Submitter: metalblend
----
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.