note 30366 added to function.str-replace
| From: | euler at free dot fr | Date: | Sat, 15 Mar 2003 14:37:18 +0000 |
| Subject: | note 30366 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45354@lists.php.net to get a copy of this message | ||
One of the contributor said that strtr was faster than str_replace, which is right, except that
strtr CANNOT remove characters from a string !
In the above example:
$str = '192.168.0.75';
$str = strtr($str,'.',"");
echo $str;
outputs: 192.168.0.75
$str = '192.168.0.75';
$str = str_replace('.',"",$str);
echo $str;
outputs: 192168075
--
http://www.php.net/manual/en/function.str-replace.php
http://master.php.net/manage/user-notes.php?action=edit+30366
http://master.php.net/manage/user-notes.php?action=delete+30366
http://master.php.net/manage/user-notes.php?action=reject+30366