- print_r: documentation ( source)
- end: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$nickname = "hello1 johns22mith123";
if(preg_match_all('!\d+!', $nickname, $numbers)){
if (isset($numbers[0])){
print_r(end($numbers[0]));
}
}