3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Foo { use Bar as Baz; } namespace Foo { class Bar { public $y = 2; } } namespace Foo { class Baz { public $x = 1; } } namespace { $x = new Bar(); $y = new Baz(); echo $x->y; echo $y->x; }
Output for 7.0.0 - 7.3.1
Fatal error: Uncaught Error: Class 'Bar' not found in /in/TMfPY:15 Stack trace: #0 {main} thrown in /in/TMfPY on line 15
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Class undefined: Bar in /in/TMfPY:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.15.4 - 3.21.3
Fatal error: Uncaught Error: Class undefined: Bar in /in/TMfPY:15 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.30
Fatal error: Class 'Bar' not found in /in/TMfPY on line 15
Process exited with code 255.