// int substr_compare(string $main_str , string $str , int $offset
// [, int $length [, bool $case_insensitivity = false ]])
// offset - start position for the comparison. If negative - starts from end of string
// Returns < 0 if main_str < str, > 0 if main_str > str, and 0 if they are equal
echo substr_compare("abcdefg", "bcd", -1, 2) . "<br />" ;
echo substr_compare("abcdefg", "bcd", -1, 3) . "<br />" ;
echo substr_compare("abcdefg", "bcd", -1, 5) . "<br />" ;
echo substr_compare("abcdefg", "bcd", -6, 3) . "<br />" ;
/*
run:
1
1
1
0
*/