This is about PHP built-in interface iterator, PHP5 started to support the interface, and built-in iterator interface, so if you define a class, and implement the iterator interface, then your class object is Zend_iter_object, otherwise it is Zend_iter_plain_object.
For Zend_iter_plain_object classes, foreach obtains an array of default properties for the object through Hash_of, and then foreach the array.
For Zend_iter_object class objects, foreach is done by invoking the iterator interface-related functions implemented by the object, so for this question, the following answers can be made:
<?phpclass Sample implements Iterator{private $_items = Array (1,2,3,4,5,6,7);p ublic function __construct () { ;// Void}public function Rewind () {Reset ($this->_items);} Public function current () {return current ($this->_items);} Public Function key () {return key ($this->_items);} Public function Next () {return next ($this->_items);} Public Function valid () {return ($this->current ()!== false);}} $sa = new sample (), foreach ($sa as $key = = $val) {print $key. "=". $val;}? >