$data = "123_String"; $whatIWant = substr($data, strpos($data, "_") + 1); echo $whatIWant;
<?php $my_url = 'http://www.example.com/5478631'; echo substr($my_url, strrpos($my_url, '/' )+1)." "; ?> // print: 5478631