How to get the last 10 digits from a string?

Good day!

Tell me how the regular season to string the last 10 digits?
for example, there are phone numbers 87771234567 the output should be 7771234567
or +77771234567 the output should be - 7771234567
June 5th 19 at 21:01
2 answers
June 5th 19 at 21:03
Solution

$input = "87771234567";
$output = substr($input, -10);

echo $output;
by the way, Yes, something I'd forgotten :) - Lisette.Bailey commented on June 5th 19 at 21:06
June 5th 19 at 21:05
Solution
$input = "87771234567";
$output = substr($input, strlen($input)-10);

echo $output;

Find more questions by tags PHPRegular expressions