Re: how to do a ireplace
| From: | Joris Trooster / Interstroom | Date: | Thu, 08 Feb 2001 16:50:28 +0000 |
| Subject: | Re: how to do a ireplace | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-95@lists.php.net to get a copy of this message | ||
HOWTO ireplace:
For case INsensitive replace add the folowing at the end of
Smarty.addons.php
function smarty_mod_ireplace($string, $search, $replace)
{
return preg_replace("/".preg_quote($search)."/i", $replace,
$string);
}
Add in Smarty.class.php at the custom_mods array:
'ireplace' => 'smarty_mod_ireplace'
Now you can use ireplace, just like the replace function.
Regards,
Joris