Re: Re: Muti-Dimensional Array Help Please
| From: | M. Sokolewicz | Date: | Thu, 07 Oct 2004 13:48:50 +0000 |
| Subject: | Re: Re: Muti-Dimensional Array Help Please | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198831@lists.php.net to get a copy of this message | ||
Nick Wilson wrote:
* and then M. Sokolewicz declared....just means the following: if($max >= count($ips) { $max = $max; } else { $max = count($ips); } :)However, if it does matter, then I suggest a different way. This wouldYes, it does matter, a *lot* ;-) I have to hit each machine in order, choosing an IP from that machine and using it do 'do_stuff()'order them by their 2nd index, not the first (meaning by $machines[1][1], $machines[2][1], etc); <?php $max = 0; foreach($machines as $machineId => $ips) { $max = ($max >= count($ips) ? $max : count($ips)); } for($i=0;$i<$max;$i++) { foreach($machines as $machineId => $ips) {Would that work with what i said above? im afraid i've never got the hang of the ? operator and dont really understand your code, sorry... thanks very much.. $max = ($max >= count($ips) ? $max : count($ips));if(isset($ips[$i])) { do_stuff($ips[$i]); } else { continue; }} } ?>