|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-10-28 09:16 UTC] waldschrott@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 12:00:02 2025 UTC |
I found a rather strange problem with reference to objects. Take the following: <?php class foo { var $Name; function foo($name) { $this->Name = $name; } } $bar = new foo('Mike'); $list[] =& $bar; //unset($bar); $bar = new foo('Jeremy'); $list[] =& $bar; while(list($key, $val) = each($list)) echo "<br>$key = $val->Name"; ?> When going through the loop and echoing the Name parameter the both return Jeremy. If I unset $bar first (by uncommenting it) it works fine. I'm not exactly sure what's going on but it is rather strange. Mike