3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { public $foo; function setFoo($foo) { $this->foo = $foo; } function getFoo($foo) { return $this->foo; } } class B { function setObj(A $a, $value) { $a->setFoo($value); } } $a = new A(); $b = new B(); $a->setFoo(1); echo $a->getFoo(), PHP_EOL; $b->setObj($a, 5); echo $a->getFoo(), PHP_EOL;
based on cEHbU
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::getFoo(), 0 passed in /in/WPu9M on line 22 and exactly 1 expected in /in/WPu9M:7 Stack trace: #0 /in/WPu9M(22): A->getFoo() #1 {main} thrown in /in/WPu9M on line 7
Process exited with code 255.
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 1 for A::getFoo(), called in /in/WPu9M on line 22 and defined in /in/WPu9M on line 7 1 Warning: Missing argument 1 for A::getFoo(), called in /in/WPu9M on line 25 and defined in /in/WPu9M on line 7 5
Output for hhvm-3.12.0
Warning: getFoo() expects exactly 1 parameter, 0 given in /in/WPu9M on line 8 1 Warning: getFoo() expects exactly 1 parameter, 0 given in /in/WPu9M on line 8 5
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.2 - 5.0.5
Warning: Missing argument 1 for A::getFoo() in /in/WPu9M on line 7 1 Warning: Missing argument 1 for A::getFoo() in /in/WPu9M on line 7 5
Output for 5.0.0 - 5.0.1
Warning: Missing argument 1 for A::getFoo() in /in/WPu9M on line 7 1 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WPu9M on line 22 PHP_EOL Warning: Missing argument 1 for A::getFoo() in /in/WPu9M on line 7 5 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WPu9M on line 25 PHP_EOL
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/WPu9M 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/WPu9M 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/WPu9M on line 3
Process exited with code 255.