objects which implement the Traversable interface, as well as arrays. It means the function can accept or return a value which will work with the looping constructs.
{ public function Current() { /* ... */ } public function Key() { /* ... */ } public function Next() { /* ... */ } public function Rewind() { /* ... */ } public function Valid() { /* ... */ } }
give it a direct array. CanHasIter([1, 2, 3]); // give it an array variable. CanHasIter($Stuff); // give it an iterable object. CanHasIter($Pile); // give it an iterable object. CanHasIter($Pile->StartsWithVowel()); // give it a generator. CanHasIter(ImAnGenerator()); // give it a string. (intentional error) CanHasIter('omfg');
array > omg wtf bbq by Pile > omg wtf bbq by Pile > omg by Generator > 1 2 3 Fatal error: Uncaught TypeError: Argument 1 passed to CanHasIter() must be iterable, string given
function returns nothing." aka "i does things, not give things" It means so much nothing that even `return NULL` is not valid. Function must EOB or end with a flat with `return;` Can only be used as a return type, not an argument type.