3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Configure here: $userSpecifiedPath = '/'; // ================================================================ // Don't edit below // ================================================================ $routerConfig = <<<CONFIG [/] "Controller" = "HomepageController" [404] "Controller" = "404Controller" CONFIG; class Router { private $routes; public function __construct($routes) { $this->routes = $routes; } public function getControllerFromPath($path) { if(array_key_exists($path, $this->routes) === true) { return $this->routes[$path]; } elseif(array_key_exists('404', $this->routes) === true) { return $this->routes['404']; } } } $routes = ini_parse_string($routerConfig, true); $Router = new Router($routes); echo 'Using controller: ' . $Router->getControllerFromPath($userSpecifiedPath);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function ini_parse_string() in /in/864J1:41 Stack trace: #0 {main} thrown in /in/864J1 on line 41
Process exited with code 255.
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0
Fatal error: Call to undefined function ini_parse_string() in /in/864J1 on line 41
Process exited with code 255.
Output for 5.1.2
Fatal error: Call to undefined function ini_parse_string() in /in/864J1 on line 42
Process exited with code 255.
Output for 4.4.3 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/864J1 on line 26
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/864J1 on line 27
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/864J1 on line 26
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/864J1 on line 26
Process exited with code 255.