get the last 7 characters of a PHP string

php-mysql

get the last 7 characters of a PHP string Use substr() with a negative number for the 2nd argument. $newstring = substr($dynamicstring, -7); string substr ( string $string , int $start [, int $length ] ) If start is negative, the returned string will start at the start’th character from the end of string Example: <?php echo … Read more