3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ function a(){ $this->c = 4; function b() { $this->c += 4; } function c(){ echo $this->c; } $this->a->b(); $this->a->c(); } } $o = new A(); $o->a();
based on HRB8v
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in /in/UZ84u on line 3 Notice: Undefined property: A::$a in /in/UZ84u on line 16 Fatal error: Uncaught Error: Call to a member function b() on null in /in/UZ84u:16 Stack trace: #0 /in/UZ84u(24): A->a() #1 {main} thrown in /in/UZ84u on line 16
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Notice: Undefined property: A::$a in /in/UZ84u on line 16 Fatal error: Call to a member function b() on null in /in/UZ84u on line 16
Process exited with code 255.
Output for 5.4.0 - 5.5.38
Notice: Undefined property: A::$a in /in/UZ84u on line 16 Fatal error: Call to a member function b() on a non-object in /in/UZ84u on line 16
Process exited with code 255.