unemployment Posted February 12, 2011 Share Posted February 12, 2011 I know I can do this.... foreach ($conversations as $conversation) but can I do this foreach ($conversations as $conversation and $messages as $message) Let me know. I need both of these in my for loop. Link to comment https://forums.phpfreaks.com/topic/227430-for-loop/ Share on other sites More sharing options...
Pikachu2000 Posted February 12, 2011 Share Posted February 12, 2011 You can't do that in a foreach() loop. Link to comment https://forums.phpfreaks.com/topic/227430-for-loop/#findComment-1173108 Share on other sites More sharing options...
AtomicRax Posted February 12, 2011 Share Posted February 12, 2011 If you are certain the two arrays have the same number of records and you're simply trying to get the corresponding information from both of them at once, you can try something like this: for ($x = 0; $x<count($conversations); $x++) { $conversation = $conversations[$x]; $message = $messages[$x]; } Link to comment https://forums.phpfreaks.com/topic/227430-for-loop/#findComment-1173117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.