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 = '[^\/]+$'; preg_match($pattern, $path, $matches); echo $matches[1]; //echo $path;

preferences:
56.91 ms | 402 KiB | 5 Q