3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar; class A { } class B { public function __construct($type) { $fullType = 'Foo\\Bar\\' . $type; echo "try to create $fullType\n"; new $fullType; echo "$fullType created\n"; $fullType = get_class($type . '::class'); echo "try to create $type::class ($fullType)\n"; new $fullType; echo "$type::class ($fullType) created\n"; echo "try to create $type\n"; new $type; echo "$type created\n"; } } new A; new B('A');

preferences:
41.72 ms | 402 KiB | 5 Q