3v4l.org

run code in 300+ PHP versions simultaneously
<?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.5.24 - 5.5.30, 5.6.8 - 5.6.16
Fatal error: No code may exist outside of namespace {} in /in/Phus5 on line 29
Process exited with code 255.

preferences:
168.46 ms | 1395 KiB | 25 Q