|
Object IterationPHP provides a way for objects to be defined so it is possible to iterate through a list of items, with, for example a foreach statement. By default, all visible properties will be used for the iteration. Example #1 Simple Object Iteration
The above example will output: var1 => value 1 var2 => value 2 var3 => value 3 MyClass::iterateVisible: var1 => value 1 var2 => value 2 var3 => value 3 protected => protected var private => private var As the output shows, the foreach iterated through all of the visible properties that could be accessed. |