php substring from 7 char from last character code example Example: take last four digits php $newstring = substr($dynamicstring, -7);