select 4th character from the end of a string in php code example Example: php nth characters from end of string $rest = substr("abcdef", -3, 1); // returns 'd'