posted by
eftychia at 10:20am on 2007-03-24 under programming
Okay, I cannot figure out how to make foreach() iterate over an array of objects, assigning keys to a loop variable, in PHP4. Either what I'm trying to do constitutes abuse of the foreach() control structure, or I need more sleep. (I'm hoping it's the second of those two possibilities and will make more sense by this afternoon.)
Wheee!
(no subject)
doesn't look like it can be done. like classic C++ you need to know what properties are in your object before you code it.
(no subject)
array_keys()for the loop instead of just sticking the array-of-objects there bare, so it sounds as though I solved the "you need PHP5 for that" problem you've outlined as a side effect of my sleepy flailing before I found the stupid typo.(no subject)