This can be done by using the substr which will return a part of a string.
The sample code below will return the letter f
$lastChar= substr("abcdef", -1);The -1 is negative, the returned string will start at the last character from the end of the string.