note 48095 added to function.strtr
| From: | php-general at lists dot php dot net | Date: | Sat, 11 Dec 2004 13:20:03 +0000 |
| Subject: | note 48095 added to function.strtr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81681@lists.php.net to get a copy of this message | ||
If you are going to call strtr a lot, consider using str_replace instead, as it is much faster. I
cut execution time in half just by doing this.
<?
// i.e. instead of:
$s=strtr($s,$replace_array);
// use:
foreach($replace_array as $key=>$value) $s=str_replace($key,$value,$s);
?>
----
Manual Page -- http://www.php.net/manual/en/function.strtr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48095
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48095&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48095&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48095&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48095&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48095&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48095&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48095&report=yes
Search -- http://master.php.net/manage/user-notes.php