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.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
string(16) "Nested\Name\Name" bool(true) object(Nested\Name\Name)#1 (0) { }

preferences:
108.01 ms | 1365 KiB | 4 Q