3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Logger { public function log($message); } class TerminalLogger implements Logger { public function log($message) { var_dump($message); } } class Application { protected $logger; public function setLogger($logger) { $this->logger = $logger; return $this; } public function action() { $this->logger->log(); } } $app = new Application(); $app->setLogger(new TerminalLogger); $app->action();
based on nt5Hm
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function TerminalLogger::log(), 0 passed in /in/6uq9p on line 22 and exactly 1 expected in /in/6uq9p:7 Stack trace: #0 /in/6uq9p(22): TerminalLogger->log() #1 /in/6uq9p(28): Application->action() #2 {main} thrown in /in/6uq9p on line 7
Process exited with code 255.
Output for 5.3.20 - 7.0.20
Warning: Missing argument 1 for TerminalLogger::log(), called in /in/6uq9p on line 22 and defined in /in/6uq9p on line 7 Notice: Undefined variable: message in /in/6uq9p on line 8 NULL