I have a string like this:
\" 23 PM\"
I would like to remove 23 so I\'m left with PM or (with space truncated) ju
23
PM
If you just want the last two characters of the string, use substr with a negative start:
$pm = substr(" 23 PM", -2); // -> "PM"