3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PhpNw15Conference { public function listSpeakers() { return array('James Mallison', 'Some universally hated Ruby developer'); }} /** * Class Controller */ class Controller extends BaseController { /** * @return array */ public function __construct(PhpNw15Conference $conference) { $this->conference = $conference; } public function speakersAction() { $speakers = $this->conference->listSpeakers(); /** Pass to template or CLI runner **/ return $speakers; } } /** Controller Resolver **/ $controller = 'Controller'; // Retrieved from URL + YAML config $action = 'speakersAction'; // Retrieved from URL + Yaml config $params = array(); // Retrieved from GET / POST parameters $reflector = new \ReflectionClass('Controller'); foreach ($reflector->getConstructor()->getParameters() as $parameter) { $className = $parameter->getClass()->getName(); $parameter = new $className; } var_dump((new $controller($parameter))->$action($params));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Class "BaseController" not found in /in/nmGfq:8 Stack trace: #0 {main} thrown in /in/nmGfq on line 8
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'BaseController' not found in /in/nmGfq:8 Stack trace: #0 {main} thrown in /in/nmGfq on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33
Fatal error: Class 'BaseController' not found in /in/nmGfq on line 8
Process exited with code 255.
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.21
Fatal error: Class 'BaseController' not found in /in/nmGfq on line 9
Process exited with code 255.

preferences:
184.58 ms | 402 KiB | 241 Q