Save strpos.php as stringcase.php.  Add the function strtolower() around both strings like this:

$stringToSearch=strtolower("Do not write my name as fred because it is Fred with a capital.");
$position=strpos($stringToSearch, strtolower("Fred"));
if ($position!=0){
    echo $position;
} else {
    echo "Sorry the string was not found.";
}

If you are used to using windows you might think that M is the same thing as m.  It is not a two completely different codes are sent from your keyboard when you type them.  In strpos.php you searched for a name inside a string.  It did not match fred but it did find Fred

If you don't care what case you want to find you can convert the string to all upper or all lower case and then try to match that.

If you do not understand what the code is doing try using alert to show $stringToSearch.