One thing I discovered when I played around with PHP, making my db abstraction, was that the Iterator interface is slow.
Not only when using it, but also in general.
I tested with 10 000 quereies to the db, then iterated them as an array ($query->result()) with a foreach.
The query objects had “implements Iterator”, and it was slow.
After I commented the “implements Iterator”, it sped up with about 0.35 sec, more than 10% !!!
So I’ve realized that the PHP 4 way is in many cases faster than the PHP 5 way (usually the PHP 5 way is including lots of function calls, which is expensive).
PHP 5 has some (very good) benefits (class abstraction, visibility, singletons, method chaining), but it isn’t so fast when doing some OOP concepts.