3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class myClass { public function toCall() { echo 'called'; } public function fromCall(callable $call) { echo 'from'; } public function __construct() { $this->fromCall($this, 'toCall'); } } $myClass = new myClass();
based on LTNqL
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: Argument 1 passed to myClass::fromCall() must be callable, object given, called in /in/XD04K on line 14 and defined in /in/XD04K:8 Stack trace: #0 /in/XD04K(14): myClass->fromCall(Object(myClass), 'toCall') #1 /in/XD04K(19): myClass->__construct() #2 {main} thrown in /in/XD04K on line 8
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught TypeError: Argument 1 passed to myClass::fromCall() must be an instance of callable, myClass given in /in/XD04K:10 Stack trace: #0 /in/XD04K(14): myClass->fromCall() #1 /in/XD04K(19): myClass->__construct() #2 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Catchable fatal error: Argument 1 passed to myClass::fromCall() must be an instance of callable, myClass given in /in/XD04K on line 10
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Catchable fatal error: Argument 1 passed to myClass::fromCall() must be callable, object given, called in /in/XD04K on line 14 and defined in /in/XD04K on line 8
Process exited with code 255.
Output for 5.2.0 - 5.3.29
Catchable fatal error: Argument 1 passed to myClass::fromCall() must be an instance of callable, instance of myClass given, called in /in/XD04K on line 14 and defined in /in/XD04K on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'callable' not found in /in/XD04K on line 8
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/XD04K on line 4
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/XD04K on line 4
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/XD04K on line 4
Process exited with code 255.