3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { function bar() { $this->a = 5; } function foo() { unset($this->a); } } $f = new foo(); $f->bar(); var_dump($f); $f->foo(); var_dump($f);
Output for 7.0.0 - 7.3.1
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/6rcts on line 4 object(foo)#1 (1) { ["a"]=> int(5) } object(foo)#1 (0) { }
Output for 5.0.0 - 5.6.28
object(foo)#1 (1) { ["a"]=> int(5) } object(foo)#1 (0) { }
Output for 4.3.0 - 4.4.9
object(foo)(1) { ["a"]=> int(5) } object(foo)(0) { }