note 36078 added to function.implode

From: Date: Thu, 25 Sep 2003 02:58:55 +0000
Subject: note 36078 added to function.implode
Groups: php.notes 
Request: Send a blank email to php-notes+get-57077@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.implode.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36078 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36078&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36078&report=yes

« previous php.notes (#57077) next »