3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace Foo\Bar\String; interface I {} class A implements I {} class B implements I {} class C implements I {} use Foo\Bar\String as MyString; function test(MyString\I $o) { var_dump($o::class); } test(new A()); test(new B()); test(new C());
Output for 8.2.7 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34
string(16) "Foo\Bar\String\A" string(16) "Foo\Bar\String\B" string(16) "Foo\Bar\String\C"
Output for 8.2.0 - 8.2.6
Fatal error: Cannot alias 'Foo\Bar\String' as it is a built-in type in /in/Q9Fbi on line 11
Process exited with code 255.

preferences:
17.48 ms | 1169 KiB | 6 Q