- substr: documentation ( source)
- stristr: documentation ( source)
- str_ireplace: documentation ( source)
<?php
$s = "ab";
$s1 = "cAbfAbe";
$s2 = $s;
do {
$s2 = stristr($s1,$s2);
echo $s2."\n";
echo substr($s2,0,count($s)+1).".\n";
} while ($s2);
echo str_ireplace($s,$s,$s1);