The standard PHP way to test whether a string $str ends with a substring $test is:
$str
$test
$endsWith = substr( $str, -strlen( $test ) ) ==
Don't know if this is fast or not but for a single character test, these work, too:
(array_pop(str_split($string)) === $test) ? true : false; ($string[strlen($string)-1] === $test) ? true : false; (strrev($string)[0] === $test) ? true : false;