3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar; class Bar {} var_dump(new Bar); namespace Foo\Baz; use Foo\Bar\Bar; class Baz { public function __construct(){ $str1 = '\\Foo\\Bar\\Bar'; $str2 = 'Bar'; var_dump(new Bar); var_dump(new $str1); var_dump(new $str2::class); } } $baz = new Baz;
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting variable (T_VARIABLE) or '$' in /in/ZgqVM on line 19
Process exited with code 255.

preferences:
172.74 ms | 1399 KiB | 22 Q