note 107345 modified in function.strtr by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 21:25:28 +0000 |
| Subject: | note 107345 modified in function.strtr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187883@lists.php.net to get a copy of this message | ||
Case Insensitive strtr <?php function
stritr($string, $one, $two=null) { if (is_string($one)) {
return strtr($string, strtoupper($one) . strtolower($one),
"$two$two"); } else if (is_array($one)) {
$strReturn = $string foreach ($one as $key => $val)
{ $strReturn = preg_replace("'$key'i",
$val, $strReturn); } return
$strReturn; } return
$string; } ?>
--was--
<?php // Case Insensitive strtr
function stritr($string, $one, $two=null) {
if (is_string($one)) {
return strtr($string, strtoupper($one) . strtolower($one), "$two$two");
} else if (is_array($one)) {
$strReturn = $string
foreach ($one as $key => $val) {
$strReturn = preg_replace("'$key'i", $val, $strReturn);
}
return $strReturn;
}
return $string;
}
?>
http://php.net/manual/en/function.strtr.php