I'm sure there must be an easy way to get nth character from the end of string.
For example:
$NthChar = get_nth('Hello', 3); // will result in $NthChar='e'
from substr examples
// Accessing single characters in a string
// can also be achieved using "square brackets"
thus:
$str = "isogram";
echo $str[-1]; // m
echo $str[-2]; // a
echo $str[-3]; // r
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With