Lea Verou
02-07-2006, 05:58 AM
Is there an alternative of str_ireplace if somebody has a php vesion <5?
I seached php.net but didn't find anything :( :(
Xenon
02-07-2006, 09:20 PM
preg_replace is case insensitive, if you set the correct parameters:
function ($find, $replace, $string)
{
if (is_array($find))
{
$regfind = array();
// sanitize findarray
foreach ($find AS $findstring)
{
$regfind[] = '#' . preg_quote($findstring, '#') . '#i';
}
}
else
{
$regfind = '#' . preg_quote($find, '#') . '#i';
}
return preg_replace($regfind, $replace, $string);
}
(that should work normally, but not tested ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.