Zend
200-550 · Question #223
Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2) $obj = new C(); foreach ($obj as $x => $y) { echo $x, $y; }
The correct answer is A. Iterator C. IteratorAggregate. See the full explanation below for the reasoning.
Question
Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2) $obj = new C(); foreach ($obj as $x => $y) { echo $x, $y; }
Options
- AIterator
- BArrayAccess
- CIteratorAggregate
- DArrayObject
How the community answered
(28 responses)- A79% (22)
- B7% (2)
- D14% (4)
Community Discussion
No community discussion yet for this question.