3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
59.17 ms | 402 KiB | 5 Q