about php manual Classes and Objects (PHP 5) Example#5 Object Assignment

[email protected] (tatsuki monji) Mon, 12 Jul 2010 16:32:53 +0900
Newsgroups php.doc.license
Message-ID <[email protected]>
hello.
i'm monji.
i'm really grateful to your php manual.
it helps me to study php.
today i think i found the mistake in Classes and Objects (PHP 5) Example#5
Object Assignment.

example is

<?php
$assigned   =  $instance;
$reference  =& $instance;

$instance->var = '$assigned will have this value';

$instance = null; // $instance and $reference become null

var_dump($instance);
var_dump($reference);
var_dump($assigned);
?>

and it say

The above example will output:

NULL
NULL
object(SimpleClass)#1 (1) {
   ["var"]=>
     string(30) "$assigned will have this value"
}

but it output
NULL
NULL
NULL

i think example should be like this

	<?php

	$instance->var = '$assigned will have this value';


	$assigned   =  $instance;

	$reference  =& $instance;


	$instance = null; // $instance and $reference become null


	var_dump($instance);

	var_dump($reference);

	var_dump($assigned);

	?>

please check that.

i'm sorry for my poor english.