3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo { class Bar { public $from = 'foo'; } } namespace Bazzle { use Foo\Bar; class Bar { public $from = 'bazzle'; } echo (new Bar())->from; }
based on B6FXq
Output for 7.0.7 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
Fatal error: Cannot declare class Bazzle\Bar because the name is already in use in /in/tGv74 on line 15
Process exited with code 255.
Output for 7.0.0 - 7.0.6
foo
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Cannot declare class Bazzle\Bar because the name is already in use in /in/tGv74 on line 16
Process exited with code 255.