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->b(); $this->c(); } } $o = new A(); $o->a();
based on ZIDAC
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/HRB8v on line 3 Fatal error: Uncaught Error: Call to undefined method A::b() in /in/HRB8v:16 Stack trace: #0 /in/HRB8v(23): A->a() #1 {main} thrown in /in/HRB8v on line 16
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Call to undefined method A::b() in /in/HRB8v on line 16
Process exited with code 255.