Still having the problem.
Here is the code:
function EndsWith($s, $find, $caseSensitive= 0)
{
$i= strlen($s);
$ci= strlen($find);
if(!$ci || !$i)
return 0;
--$i; --$ci;
$sl; $findL;
if(!$caseSensitive)
{
$sl= strtolower($s); $findL= strtolower($find);
}
for(; $i >= 0 && $ci >= 0; --$i, --$ci)
{
if($caseSensitive)
{
if($s[$i] !== $find[$ci])
return 0;
}
else
{
if($sl[$i] !== $findL[$ci])
{
echo $ci." ";
return 0;
}
else echo $ci." ";
}
}
if($ci == -1)
return 1;
return 0;
}
Output is when $ci starts at 3 is:
3 2 1 0 3