PHP ver gevorderde |
|
dit:
<?php
function str_ireplace($needle, $replace, $string)
{
$string = preg_replace('#'.$needle.'#i', $replace, $string);
return $string;
}
$string = 'Niet';
echo str_replace('niet', 'Wel', $string).'<br />';
echo str_ireplace('niet', 'Wel', $string).'<br />';
?>
<?php function str_ireplace($needle, $replace, $string) { $string = preg_replace('#'.$needle.'#i', $replace, $string); return $string; } $string = 'Niet'; echo str_ireplace ('niet', 'Wel', $string).'<br />'; ?>
|