laravel get last two digitit of a string code example Example: take last four digits php $newstring = substr($dynamicstring, -7);