note 40460 deleted from function.strtr by irchtml

From: Date: Thu, 04 Mar 2004 13:14:41 +0000
Subject: note 40460 deleted from function.strtr by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66239@lists.php.net to get a copy of this message
Note Submitter: tim warden ---- to the gentlemen commenting on execution times of strtr() vs. str_replace(). i just tried the two routines under identical circumstances, and my results were quite the opposite of yours. strtr() was significantly faster than str_replace(). it would also seem that in cristiano's example below, you pay a hefty penalty using the original $tr array to create the $to and $from arrays in that for loop. i realize that benching is both an art and a science, but any clarification of your measurements would be appreciated... (i.e. in your tests, how many elements in the translation arrays? avg size of those strings? avg size of the source strings? tim

« previous php.notes (#66239) next »