On Jun 30, 2006, at 5:04 PM, Adam Zey wrote:
I mean, do this: foreach ( array_keys($workArr) as $key ) { echo $workArr[$key]['foo']; } instead of this: foreach ( $workArr as $key => $value ) { echo $value['foo']; }
Okay, I think I get the idea. So using my code example... this: foreach ($workArr['post_id'] as $value) { if ($workArr['parent_id'][$value]==$post_id) { processthread($workArr['post_id'][$value], &$workArr); } // end if would become this?: foreach (arraykeys($workArr['post_id'] as $key) { if ($workArr['parent_id'][$key]==$post_id) { processthread($workArr['post_id'][$key], &$workArr); } // end ifSeems to work just fine. Will take the hamsters running in my brain a little more time to fully understand it... :-)
Thanks again for all your help. - Ben
Both let you do the same thing, you just reference data differently, and the first example involves working with the original array, so foreach has no chance to copy it. HOWEVER, if my above supposition about foreach not copying a reference is correct, you wouldn't need to do this. It's just a backup plan.Regards, Adam.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature