3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Baz\Qux { class Foo { public function __construct($bar) { var_dump(1); } public function Foo($bar) { var_dump(2); } } class Bar { public function Bar() { var_dump(3); } } } class Foo { public function Foo($bar) { var_dump(2); } }
Output for 7.0.0 - 7.0.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/Phus5 on line 23 Fatal error: No code may exist outside of namespace {} in /in/Phus5 on line 23
Process exited with code 255.
Output for 5.3.21 - 5.6.16
Fatal error: No code may exist outside of namespace {} in /in/Phus5 on line 29
Process exited with code 255.