Hi! > Yep, today we have : > - arrays > - Object implementing ArrayAccess > - Objects implementing Traversable (Iterator) > - array_****() functions not working with ArrayAccess' objects > - Iterator API not working with arrays (ArrayIterator needed) > - ... I forget things > > There sure is something to do with that to make a consistent API.
Definitely, having consistent generic iteration API would be great, and pretty much the only reason many iterative functions don't suport traversables is that there's no such API. As for ArrayAccess, it's more complicated. For example, if you have array_shift() I'm not sure ArrayAccess is enough to implement it. To find out "first" element you'd need Traversable, but even that won't allow you to "shift" array elements. So for some array_* functions only thing that you can rely on is an actual array... -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php