note 20462 added to function.explode
| From: | ken at positive-edge dot com | Date: | Thu, 04 Apr 2002 12:47:56 +0000 |
| Subject: | note 20462 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28603@lists.php.net to get a copy of this message | ||
Just as a quick node, if you are trying to explode a string into an array by spaces and tabs, I did
some profiling (for a time-intensive application) and the results suggest that doing a
$array = preg_split( "/[ \t]+/", $string );
is jsut as fast as doing the explode. I don't mean 'roughly' - I really mean to
microsecond. The test conducted were executed over 50,000 times on various strings and the time was
nearly identical. Thought this would help people profile their stuff better.
--
http://www.php.net/manual/en/function.explode.php
http://master.php.net/manage/user-notes.php?action=edit+20462
http://master.php.net/manage/user-notes.php?action=delete+20462
http://master.php.net/manage/user-notes.php?action=reject+20462