substr($myStr, -4, 4);
or generically: substr(string, pos, number);
This function returns [number] characters from [string], starting at position [pos]. If [pos] < 0, it starts that many characters from the end, e.g. -4 means start 4 characters from the end of [string].
|