3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = "http://127.0.0.1:3333/item/id/3"; $path = parse_url($string, PHP_URL_PATH); $pattern = '/(\d+)$/'; preg_match($pattern, $path, $matches); $id = $matches[1]; //echo $path;
based on h0MsZ
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0beta1