A substitute for str_ireplace()
which I wrote to allow its usage on PHP versions below 5.
Usage
$test = str_ireplace("Test", "foo", "test TEST Test t3st");
echo $test; // "foo foo foo t3st"
Code
function str_ireplace($search, $replace, $subject, &$count = null) {
$search = "#" . addcslashes(preg_quote($search), '#') . "#i";
if ($count == null) {
return preg_replace($search, $replace, $subject);
}
return preg_replace($search, $replace, $subject, -1, $count);
}