Ambil empat digit terakhir PHP
$newstring = substr($dynamicstring, -7);
Crazy Caterpillar
$newstring = substr($dynamicstring, -7);
$number = 12356;
$lastDigit = $number % 10;
echo $lastDigit; // 6