* Thus wrote John Holmes: > > A later example implements ArrayAccess and IteratorAggregate and then > says you can use count($A), but it doesn't work for my tests. It always > returns 1.
That example i think is minor mistake. As noted in the example above you have to call pass ->getIterator() to count(). count() doesn't detect if the object if getIterator is present, its just returns 1 since $A isn't an array. BUT.. this works: echo count( (array)$A ); Yet, even if you use count($A->getIterator()) or cast the object, the indexes (0,1,2) arn't defined, unlesss you redifine the offsetGet() to get the proper one. Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php