3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X { public function __construct($a = 0) { $a = 33; $this->a(); } protected function a() { echo $a.'x'; } } $x = new X(); $x->a();
based on PAAgc
Output for 7.0.0 - 7.2.12
Notice: Undefined variable: a in /in/p2h7H on line 11 x Fatal error: Uncaught Error: Call to protected method X::a() from context '' in /in/p2h7H:19 Stack trace: #0 {main} thrown in /in/p2h7H on line 19
Process exited with code 255.
Output for hhvm-3.22.0
Notice: Undefined variable: a in /in/p2h7H on line -1 x Fatal error: Uncaught Error: Call to protected X::a() from invalid context in /in/p2h7H:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.15.4 - 3.21.3
Notice: Undefined variable: a in /in/p2h7H on line 11 x Fatal error: Uncaught Error: Call to protected X::a() from invalid context in /in/p2h7H:19 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Notice: Undefined variable: a in /in/p2h7H on line 11 x Fatal error: Call to protected method X::a() from context '' in /in/p2h7H on line 19
Process exited with code 255.