note 63065 deleted from language.references.unset by danbrown
| From: | danbrown@php.net | Date: | Wed, 20 Apr 2011 16:24:26 +0000 |
| Subject: | note 63065 deleted from language.references.unset by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179014@lists.php.net to get a copy of this message | ||
Note Submitter: rustin dot phares at hotmail dot com
----
If you wish to unset both variables, you will need to unset the last referenced variable of that
condition.
<?php
$a = 1;
$b =& $a;
unset($b);
?>
* These must be in a reference->copy hierarchy in order to unset; example:
<?php
$a = 1;
$b =& $a;
$c =& $b;
unset($c);
?>
This will not work:
<?php
$a = 1;
$b =& $a;
$c = $b;
unset($c);
?>
* Only $c is unset in the above example, meaning that both variables $b and $a are still assigned
"1".