References in constructors
Just started to learn PHP in the PHP manual see the reference to the constructor in this section below I wrote it according to the manual, but the test results are different from what the manual says.
Class foo{
function Foo ($name) {
Global $globalref;
$globalref [] = & $this;
$this->setname ($name);
$this->echoname ();
}
function Echoname ()
{
Echo '
', $this->name;
}
function SetName ($name)
{
$this->name = $name;
}
}
?>
$bar 1 = new Foo (' Set the name is PHP ');
$bar 1->echoname ();
$globalref [0]->echoname ();
Print_r ($GLOBALREF);
$bar 1->setname (' Set the name is Java ');
$bar 1->echoname ();
$globalref [0]->echoname ();
?>
------Solution--------------------
I don't know what you're describing as a "handbook."
At least from the code is based on the PHP4, as to whether in the php4 of the performance, no environment, it is unclear
------Solution--------------------
Yes, PHP5 's kernel is the same as PHP4, otherwise it's not php5 but php4.x.
As with all software systems, a change in the big version indicates a significant change.
Although there is not much difference from the point of view of PHP code, there is a change in the way of implementation. Can be thought of as essentially two languages
Therefore, the interpretation based on PHP4 cannot be used for PHP5.
Don't you see that there is an applicable version number on each function explanation page in the manual?