note 9189 added to split
| From: | fredrick-realm at home dot com | Date: | Sat, 21 Oct 2000 18:16:11 +0000 |
| Subject: | note 9189 added to split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6796@lists.php.net to get a copy of this message | ||
In geneneral, the code:
$var1 =
ereg_replace("b[^e]+e","#","abcdefgabcdefg");
is more efficiant in anyway than a .+ expression.
(If I recall correctly, this is because .+e has to read backwards to evaluate every character. i.e.
for abcdef, it has to read b to know if a is matches.. do this on a 1000 word document, and you can
already start to see the impact. The code [^e] simply sees if the character is e or not.)
http://www.php.net/manual/function.split.php