note 86561 modified in language.oop5.basic by thiago

From: Date: Thu, 23 Oct 2008 20:15:37 +0000
Subject: note 86561 modified in language.oop5.basic by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145669@lists.php.net to get a copy of this message
Example #6 Object Assignment <?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); ?> Mistake in the documentation The above example will output (PHP5): NULL NULL NULL BUT NOT (from documentation): NULL NULL object(SimpleClass)#1 (1) { ["var"]=> string(30) "$assigned will have this value" } Example of output (from documentation) could be possible in case using PHP4. --was-- Example #6 Object Assignment <?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); ?> Mistake in the documentation The above example will output (PHP5): NULL NULL NULL BUT NOT (from documentation): NULL NULL object(SimpleClass)#1 (1) { ["var"]=> string(30) "$assigned will have this value" } Example of output (from documentation) could be possible in case using PHP4. http://php.net/manual/en/language.oop5.basic.php

« previous php.notes (#145669) next »