note 29393 added to function.strtr
| From: | stew at greenseahorse dot -nospamhere- dot com | Date: | Wed, 12 Feb 2003 11:54:46 +0000 |
| Subject: | note 29393 added to function.strtr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43818@lists.php.net to get a copy of this message | ||
Interesting little thing I have noticed. Can anyone tell me why this happens?
The code :
$banned_words = array("spam" => "s**m",);
$subject = strtr($subject,$banned_words);
will only replace exactly "spam" with "s**m".
Whereas, the code:
$subject = strtr($subject,"spam","s**m");
will replace "spam", "Spam" & "spAM" with "s**m", but
not "SPAM" which remains untouched.
So. Question - why the difference in behaviour? Feature or bug? ;> And where is the
case-insensitive strtr, please?
Stewart
Green Seahorse Ltd
--
http://www.php.net/manual/en/function.strtr.php
http://master.php.net/manage/user-notes.php?action=edit+29393
http://master.php.net/manage/user-notes.php?action=delete+29393
http://master.php.net/manage/user-notes.php?action=reject+29393