3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_numerics ($str) { $matches = array(); preg_match("/\[([^]]*)\]/", $str, $matches); $matches = preg_replace("/[^0-9]/", '', $str); return ($matches); } $one = 'SP1-SP200'; print_r(get_numerics($one));

preferences:
53.46 ms | 402 KiB | 5 Q