From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.16
PHP version:      4.0.4pl1
PHP Bug Type:     Class/Object related
Bug description:  foreach() operates on a copy of an object

The following two array looping statements are not equal
(Assuming Update() updates some instance variables in the 

foreach( $objs as $o )


for($i=0; $i<count($objs); ++$i)

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.

Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to