l'ho scritta adesso e non l'ho testata molto
codice:
if(!function_exists( 'str_ireplace' )) {
function str_ireplace($find, $replace, $str) {
$tmpfind = array(
'\\\','/','[',']','(',
')','*','+','-','?',
'^','$','.','|','{','}'
);
$tmpreplace = array(
'\\\\\','\/','\[','\]','\(',
'\)','\*','\+','\-','\?',
'\^','\$','\.','\|','\{','\}'
);
if(!is_array($find))
$find = array($find);
for($a = 0, $b = count($find); $a < $b; $a++)
$find[$a] = '/(?i)'.str_replace($tmpfind, $tmpreplace, $find[$a]).'/';
return preg_replace($find, $replace, $str);
}
}