note 29393 rejected from function.strtr by betz
| From: | betz@php.net | Date: | Wed, 12 Feb 2003 19:10:41 +0000 |
| Subject: | note 29393 rejected from function.strtr by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43836@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