3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { protected function _new($args) { return $args; } public function __call($method, $args) { if($method === 'new') { return call_user_func_array(array($this, '_new'), $args); } else { throw new LogicException('Unknown method'); } } } $foo = new Foo; echo $foo->new('hello'); // return hello echo $foo->boo(); // throws Exception
Output for 7.0.0 - 7.1.0
hello Fatal error: Uncaught LogicException: Unknown method in /in/rnZAC:14 Stack trace: #0 /in/rnZAC(20): Foo->__call('boo', Array) #1 {main} thrown in /in/rnZAC on line 14
Process exited with code 255.
Output for hhvm-3.12.0
hello Fatal error: Uncaught exception 'LogicException' with message 'Unknown method' in /in/rnZAC:14 Stack trace: #0 /in/rnZAC(20): Foo->__call() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.6.28
hello Fatal error: Uncaught exception 'LogicException' with message 'Unknown method' in /in/rnZAC:14 Stack trace: #0 /in/rnZAC(20): Foo->__call('boo', Array) #1 /in/rnZAC(20): Foo->boo() #2 {main} thrown in /in/rnZAC on line 14
Process exited with code 255.
Output for 5.1.1 - 5.2.13, 5.3.0 - 5.3.2
hello Fatal error: Uncaught exception 'LogicException' with message 'Unknown method' in /in/rnZAC:14 Stack trace: #0 [internal function]: Foo->__call('boo', Array) #1 /in/rnZAC(20): Foo->boo() #2 {main} thrown in /in/rnZAC on line 14
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/rnZAC on line 20
Process exited with code 255.
Output for 5.0.0 - 5.0.5
hello Fatal error: Class 'LogicException' not found in /in/rnZAC on line 14
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/rnZAC on line 5
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/rnZAC on line 5
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/rnZAC on line 5
Process exited with code 255.