Re: preg_replace brain teaser

From: Date: Wed, 16 Apr 2003 13:44:11 +0000
Subject: Re: preg_replace brain teaser
Groups: php.general 
Request: Send a blank email to php-general+get-144115@lists.php.net to get a copy of this message
OKOK call me stupid ; ) Looks like I need a vacation real bad... The second testcase should actually look like this: preg_replace($pattern2, 'callback1', $string); to give a decent test so the results I posted earlier actually are irrelevant since its executing the same code.... Here are the results of the new run using the above code for the second test case All 1000 Results evaluation: Total Time 1: 0.00018324580562115 Total Time 2: 2.1518136978149E-005 (0.00002151813) So Tom Roger you are right !!! Using the callback seems to be faster by a magnitude of almost 10. So you should favour preg_replace_callback over preg_replace with the 'e' modifier. Stefan Langer

« previous php.general (#144115) next »