str_replace vs. preg_replace speed
From: Shawn McKenzie (nospam_at_mckenzies.net)
Date: 12/17/03
- Next message: David T-G: "Re: [PHP] str_replace vs. preg_replace speed"
- Previous message: Philip J. Newman: "Re: [PHP] Line breaks in PHP."
- Next in thread: David T-G: "Re: [PHP] str_replace vs. preg_replace speed"
- Reply: David T-G: "Re: [PHP] str_replace vs. preg_replace speed"
- Reply: Shawn McKenzie: "Re: str_replace vs. preg_replace speed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: php-general@lists.php.net Date: Tue, 16 Dec 2003 23:02:53 -0600
I will run some benchmarks (even though they may be flaky), but what would
be the fastest execution?
$search = array(
"<!-- [$cmd] -->",
"<!--[$cmd]-->",
"<!-- {".$cmd."} -->",
"<!--{".$cmd."}-->",
"{".$cmd."}",
);
$replace = STARTPHP." $action ".ENDPHP;
$tmpcontent = str_replace($search, $replace, $tmpcontent);
Or, if I created one expression that handled all of the five $search items
(since they are similar) and used preg_replace()?
Thanks!
-Shawn
- Next message: David T-G: "Re: [PHP] str_replace vs. preg_replace speed"
- Previous message: Philip J. Newman: "Re: [PHP] Line breaks in PHP."
- Next in thread: David T-G: "Re: [PHP] str_replace vs. preg_replace speed"
- Reply: David T-G: "Re: [PHP] str_replace vs. preg_replace speed"
- Reply: Shawn McKenzie: "Re: str_replace vs. preg_replace speed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|