Re: Re: Possible foreach bug; seeking advice to isolate the problem
| From: | David Harkness | Date: | Wed, 20 Oct 2010 17:44:27 +0000 |
| Subject: | Re: Re: Possible foreach bug; seeking advice to isolate the problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308891@lists.php.net to get a copy of this message | ||
On Wed, Oct 20, 2010 at 5:00 AM, Tommy Pham <tommyhp2@gmail.com> wrote:
> Shouldn't that be $row = null since unset will remove the last value, not
> just removing the variable also, from the array whereas the $row = null
> will
> tell the reference pointer that it doesn't point to a value.
>
No, that would assign null to the last array element. References allow you
to assign any value--including null--to the container they reference.
Unsetting a reference breaks the reference without affecting whatever it
references.
$x = 5;
$y = &$x;
$y = null;
print_r($x);
var_dump($x);
--> NULL
David