3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public function foo($fooVar) { echo 'Foo: '.$fooVar; } } class Bar extends Foo { public function foo($fooVar) { echo 'Bar: '.$fooVar; parent::foo($fooVar); } } $Bar = new Bar(); $Bar->foo('some value');
Output for 7.1.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in /in/1givs on line 3 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Foo::foo(), 0 passed in /in/1givs on line 16 and exactly 1 expected in /in/1givs:4 Stack trace: #0 /in/1givs(16): Foo->foo() #1 {main} thrown in /in/1givs on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.14
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in /in/1givs on line 3 Warning: Missing argument 1 for Foo::foo(), called in /in/1givs on line 16 and defined in /in/1givs on line 4 Notice: Undefined variable: fooVar in /in/1givs on line 5 Foo: Bar: some valueFoo: some value
Output for hhvm-3.10.0 - 3.12.0
Warning: foo() expects exactly 1 parameter, 0 given in /in/1givs on line 5 Notice: Undefined variable: fooVar in /in/1givs on line 5 Foo: Bar: some valueFoo: some value
Output for 5.5.0 - 5.6.28
Warning: Missing argument 1 for Foo::foo(), called in /in/1givs on line 16 and defined in /in/1givs on line 4 Notice: Undefined variable: fooVar in /in/1givs on line 5 Foo: Bar: some valueFoo: some value
Output for 5.2.3 - 5.4.45
Warning: Missing argument 1 for Foo::foo(), called in /in/1givs on line 16 and defined in /in/1givs on line 4 Foo: Bar: some valueFoo: some value
Output for 5.1.0 - 5.2.2
<br /> <b>Warning</b>: Missing argument 1 for Foo::foo(), called in /in/1givs on line 16 and defined in <b>/in/1givs</b> on line <b>4</b><br /> Foo: Bar: some valueFoo: some value
Output for 5.0.0 - 5.0.5
<br /> <b>Warning</b>: Missing argument 1 for Foo::foo() in <b>/in/1givs</b> on line <b>4</b><br /> Foo: Bar: some valueFoo: some value
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/1givs</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/1givs</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/1givs</b> on line <b>4</b><br />
Process exited with code 255.