php nth characters from end of string
snippet in php

take last four digits php

user1579

$newstring = substr($dynamicstring, -7);

php nth characters from end of string

user2231

  $rest = substr("abcdef", -3, 1); // returns 'd'