3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = $_SERVER['REQUEST_URI']; $path = parse_url($path, PHP_URL_PATH); $router = new Router([ new Route('/register', 'register.php') ]); $route = $router->route($path); require_once($route->get('controllerName'));
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: Undefined array key "REQUEST_URI" in /in/XjAUB on line 3 Deprecated: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated in /in/XjAUB on line 4 Fatal error: Uncaught Error: Class "Router" not found in /in/XjAUB:6 Stack trace: #0 {main} thrown in /in/XjAUB on line 6
Process exited with code 255.

preferences:
79.77 ms | 407 KiB | 5 Q