note 20813 added to control-structures.foreach

From: Date: Wed, 17 Apr 2002 07:16:44 +0000
Subject: note 20813 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-29461@lists.php.net to get a copy of this message
Just a comment about using foreach to iterate over objects: I imagine what's going on there is that when the object is thrown into the foreach it's automatically cast to type array. The casting rule (though I haven't seen it) must be to convert all property names to keys whose values are the prop values. i.e. foreach isn't really iterating over the object props, but the type-casted array. -- http://www.php.net/manual/en/control-structures.foreach.php http://master.php.net/manage/user-notes.php?action=edit+20813 http://master.php.net/manage/user-notes.php?action=delete+20813 http://master.php.net/manage/user-notes.php?action=reject+20813

« previous php.notes (#29461) next »