note 36078 rejected from function.implode by pollita
| From: | pollita@php.net | Date: | Thu, 25 Sep 2003 04:00:56 +0000 |
| Subject: | note 36078 rejected from function.implode by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57078@lists.php.net to get a copy of this message | ||
Note Submitter: spam@yahoo.com
----
Here's something weird,
The following code:
$contents = implode(" ", file("./myfile.txt"));
is actually slightly faster than:
$contents = implode("", file("./myfile.txt"));
Even using the following code:
$contents = implode(" ", file("./myfile.txt"));
$contents = str_replace("\r\n ", "\r\n", $contents);
is still faster than:
$contents = implode("", file("./myfile.txt"));
Having "" as opposed to " " probably references the use of no glue instead of an
empty string.