monkeypaw201 Posted July 30, 2008 Share Posted July 30, 2008 I need to retrieve the last 2 letters of a string. Is there a reverse substr() function? Link to comment https://forums.phpfreaks.com/topic/117281-solved-retrieving-last-2-characters-in-a-string-gt-reverse-substr/ Share on other sites More sharing options...
derekmcd Posted July 30, 2008 Share Posted July 30, 2008 you actually jsut use substr() substr("ABCD123", -4); //Returns D123 To get the last 2 simply use this substr("some string", -2); Link to comment https://forums.phpfreaks.com/topic/117281-solved-retrieving-last-2-characters-in-a-string-gt-reverse-substr/#findComment-603288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.