Re: Array references - how to unset() ?
| From: | Robert Cummings | Date: | Thu, 03 Sep 2009 14:21:29 +0000 |
| Subject: | Re: Array references - how to unset() ? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297632@lists.php.net to get a copy of this message | ||
hack988 hack988 wrote:
Reference vars in php would not be unset if it reference by another var,so you must keep original var had'nt being reference.You can't reference a reference in PHP. If you take the reference of a variable that is itself a reference then you are taking a reference to the referenced value and not the reference variable itself. This is illustrated in the following example: <?php $foo = '123'; $fee = '987'; $blah = &$foo; $bleh = &$blah; $blah = &$fee; echo 'blah: '.$blah."\n"; echo 'bleh: '.$bleh."\n"; ?> What I think you meant to say, is that a value is not unset as long as it has at least one variable referencing it. You most certainly unset the reference if you apply unset to it, it is the value referenced that may remain. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP