- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- preg_replace: documentation ( source)
<?php
$str = "Peter (1) (143)
Peter (2) (144)
Daniel (12)
";
preg_match_all("/[\d()]+$/m", $str, $match);
print_r(preg_replace("/[()]/", "", $match[0]));