Regarding creating objects, I don't understand how to use get_class() to return the class name.
葫芦娃平衡盘
葫芦娃平衡盘 2017-08-04 22:41:12
0
2
1055

class dome{
}
$w =new dome();
$w1 =new $w();
echo get_class($w1);


Create a new class whose name is dome and then generate an object of $w. At this time, I use $w1 =new $w(); to create a new object instead of assigning a value. This is how I understand it. , which is equivalent to treating $w as a class, so a new object is generated, but using echo get_class($w1); the output is still dome, not $w. What is the principle? Because $w is not a class, its class is taken.

葫芦娃平衡盘
葫芦娃平衡盘

reply all(2)
ringa_lee

There is something wrong with the code. $w has already generated an object. If you try $w1 and then new it, it won’t work. You can try $w1 = clone $w

大家讲道理

$w() is not a class

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template