1--TEST-- 2Variable as class name for new expression 3--FILE-- 4<?php 5 6$className = 'stdClass'; 7$array = ['className' => 'stdClass']; 8$obj = (object) ['className' => 'stdClass']; 9 10class Test { 11 public static $className = 'stdClass'; 12} 13$test = 'Test'; 14$weird = [0 => (object) ['foo' => 'Test']]; 15 16var_dump(new $className); 17var_dump(new $array['className']); 18var_dump(new $obj->className); 19var_dump(new Test::$className); 20var_dump(new $test::$className); 21var_dump(new $weird[0]->foo::$className); 22 23?> 24--EXPECTF-- 25object(stdClass)#%d (0) { 26} 27object(stdClass)#%d (0) { 28} 29object(stdClass)#%d (0) { 30} 31object(stdClass)#%d (0) { 32} 33object(stdClass)#%d (0) { 34} 35object(stdClass)#%d (0) { 36} 37