- strspn: documentation ( source)
- printf: documentation ( source)
<?php
$str1 = 'The Quick Brown Fox Jumps';
$str2 = 'The Quick Brown Fox JuMps';
echo 'String1-'.$str1.'<br />String2-'.$str2.'<br />';
$spos = strspn($str1 ^ $str2, "\0");
printf('First difference at position %d: "%s" vs "%s"',$spos, $str1[$spos], $str2[$spos]);
?>