3v4l.org

run code in 300+ PHP versions simultaneously
<?php eval(' namespace Foo { class Bar { const Baz = 42; } } '); const MyFoo = Foo\Bar::Baz; var_dump(MyFoo);
based on mL0I7
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.31, 7.3.0 - 7.3.19, 7.4.0 - 7.4.7, 8.0.0alpha1 - alpha2
int(42)