Forum Moderators: coopster

Message Too Old, No Replies

Iterator pattern for objects in PHP4

         

AnonyMouse

6:02 pm on Apr 26, 2006 (gmt 0)

10+ Year Member



There's plenty of documentation out there regarding iterators in PHP5, and how to iterate over arrays in PHP4, but I'm struggling with iterating over objects in PHP4.

Say you have a class of CARS, and you want a COLLECTION of CARS. My strategy was to create a Car class, and a CarCollection class. Then I want to produce a table of the car's properties by iterating over each car object in the car collection.

Is there any kind soul out there who could point me towards a good article on this, or provide me with some guidance?

Thanks in advance for any replies!

coopster

11:35 pm on Apr 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You'll probably have to write your own. If you are going to do any object work I would highly recommend upgrading to PHP5 as it makes life easier.