Using count() on a class that implements Iterator in PHP

pcexpertq8

New Member
Quick question really:I've seen in bits of code in the past where the code could call count() on a object that implements Iterator, for custom Iterator classes.I've written a class that implements Iterator and works fine in a foreach loop, but I was just wondering if there was an extra class I had to extend or function I had to implement in order for count() to work on my class, to return a value I want.
 
Back
Top