3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_numerics ($str) { preg_match('/^mom_(\d+)$/', $str, $matches); return $matches[1]; } $one = 'mom_5'; $two = 'mom_123'; $three = 'actions'; print_r(get_numerics($one)); print_r(get_numerics($two)); print_r(get_numerics($three));

preferences:
33.65 ms | 402 KiB | 5 Q