3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Log{ public static function log(){ echo 'fuck'; } } class Test{ protected $logger; public function setLogger($logger){ $this->logger = $logger; } public function fire(){ $this->logger->log(); } } $test = new Test(); $test->setLogger(Log); $test->fire();
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "Log" in /in/dUSCC:20 Stack trace: #0 {main} thrown in /in/dUSCC on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
Fatal error: Constructor Log::log() cannot be static in /in/dUSCC on line 6
Process exited with code 255.

preferences:
77.32 ms | 402 KiB | 82 Q