php get last 3 digits of anumber code example Example: take last four digits php $newstring = substr($dynamicstring, -7);