Re: Fastest commands
| From: | Shawn McKenzie | Date: | Mon, 28 Apr 2003 13:52:50 +0000 |
| Subject: | Re: Fastest commands | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145529@lists.php.net to get a copy of this message | ||
Thanks guys!
One more question. What if:
$content = "<one>, <two>, <three>";
And for example I want to replace '<one>' with '1' but the array key is
still 'one'? And further what if the array key is '[one]'?
TIA,
Shawn
"Shawn McKenzie" <nospam@mckenzies.net> wrote in message
news:20030425173101.17182.qmail@pb1.pair.com...
> Is there a list of commands or any guidance on what executes the fastest?
> There are some notes in some of the ereg_, preg_ and str_ function docs
> about which ones are faster, but what about others? Also, I want to do a
> replace where the search is array indices and the replace is the values of
> the found index. Is the following the fastest???
>
> $content = "one, two, three";
>
> $thearray = array (
> 'one' => '1',
> 'two' => '2',
> 'three' => '3',
> );
>
> foreach($thearray as $search => $replace) {
> $content = str_replace($search, $replace, $content);
> }
>
> Thanks!
> Shawn
>
>