3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Logger{ 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(Logger); $test->fire();
Output for 7.0.0 - 7.1.0
Notice: Use of undefined constant Logger - assumed 'Logger' in /in/tcRfq on line 20 Fatal error: Uncaught Error: Call to a member function log() on string in /in/tcRfq:15 Stack trace: #0 /in/tcRfq(21): Test->fire() #1 {main} thrown in /in/tcRfq on line 15
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Use of undefined constant Logger - assumed 'Logger' in /in/tcRfq on line 20 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function log() on a non-object (string)' in /in/tcRfq:15 Stack trace: #0 /in/tcRfq(21): Test->fire() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Notice: Use of undefined constant Logger - assumed 'Logger' in /in/tcRfq on line 23 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function log() on a non-object (string)' in /in/tcRfq:27 Stack trace: #0 /in/tcRfq(26): Test->fire() #1 {main}
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Notice: Use of undefined constant Logger - assumed 'Logger' in /in/tcRfq on line 20 Fatal error: Call to a member function log() on string in /in/tcRfq on line 15
Process exited with code 255.
Output for 5.0.0 - 5.5.35
Notice: Use of undefined constant Logger - assumed 'Logger' in /in/tcRfq on line 20 Fatal error: Call to a member function log() on a non-object in /in/tcRfq on line 15
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tcRfq on line 3
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/tcRfq on line 3
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/tcRfq on line 3
Process exited with code 255.