3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Nested\Name; class Test { public static function speak(string $name) { var_dump($name); // is the same as Name::class var_dump(class_exists($name)); // to see if the class exists or not var_dump(new $name); // is the same as new Name } } class Name{} Test::speak('Nested\Name\Name');
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
string(16) "Nested\Name\Name" bool(true) object(Nested\Name\Name)#1 (0) { }

preferences:
112.8 ms | 407 KiB | 5 Q