ID: 9722 Updated by: sniper Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Class/Object related Assigned To: Comments: Please read the manual: http://www.php.net/manual/en/control-structures.foreach.php "Note: Also note that foreach operates on a copy of the specified array, not the array itself, therefore the array pointer is not modified like with the each construct." --Jani Previous Comments: --------------------------------------------------------------------------- [2001-03-13 05:09:29] [EMAIL PROTECTED] The following two array looping statements are not equal (Assuming Update() updates some instance variables in the object) foreach( $objs as $o ) $o->Update() and for($i=0; $i<count($objs); ++$i) $objs[$i]->Update(); In the first case the Update() method will change an anonymous copy of the object in the array while in the second case the update will work on the object in the array. Hence any changes that Update() might do will in the first case not be done for the objects in the array. Not sure if this is a genuine bug or just a consequence of the copying semantics for objects in PHP. --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9722&edit=2 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]