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 $array{'className'});
19var_dump(new $obj->className);
20var_dump(new Test::$className);
21var_dump(new $test::$className);
22var_dump(new $weird[0]->foo::$className);
23
24?>
25--EXPECTF--
26object(stdClass)#%d (0) {
27}
28object(stdClass)#%d (0) {
29}
30object(stdClass)#%d (0) {
31}
32object(stdClass)#%d (0) {
33}
34object(stdClass)#%d (0) {
35}
36object(stdClass)#%d (0) {
37}
38object(stdClass)#%d (0) {
39}
40