Re: Arrays and Regs
| From: | Richard Lynch | Date: | Fri, 19 Jul 2002 02:18:15 +0000 |
| Subject: | Re: Arrays and Regs | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108409@lists.php.net to get a copy of this message | ||
>Just a performance question, if anyone knows for sure. Within a large
>array, would using numerical indices be quicker than associative? I'm
>talking about a *noticeable* difference in performance, here.
Almost for sure, nope.
Run a test for yourself.
>Also, on Regular Expression replacements:
>
>$text = eregi_replace("([abc]+)", "<span style=\"color:
>red\">\\1</span>", $text);
>
>Would this replace any occurences of the pattern with the same pattern
>match in red text? I'm not sure exactly how the \\1, \\2, etc. works. So, does:
Yes, for those browsers that understand the span tag.
A quick test script in PHP would have been faster than asking... :-)
>$text = eregi_replace("(a)(b)(c)", "\\1", $text);
>
>Does this output only the 'a'? I find this confusing for some reason,
>hehe. Any help would be great!
Yes. If you had \\2 and \\3 somewhere, they'd be 'b' and 'c' respectively.
Again a quick test script in PHP would have been faster...
--
Like Music? http://l-i-e.com/artists.htm