3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Logger { public function log($message); } class Application { protected $logger; public function setLogger(Logger $logger) { $this->logger = $logger; } public function doTask() { $this->logger->log('test data'); } } class FileLogger implements Logger { public function log($message) { var_dump($message); } } $app = new Application(); $app->setLogger(new FileLogger); $app->action();
based on 0OKp5
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method Application::action() in /in/SgqBO:35 Stack trace: #0 {main} thrown in /in/SgqBO on line 35
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Call to undefined method Application::action() in /in/SgqBO on line 35
Process exited with code 255.