Re: Re: Muti-Dimensional Array Help Please

From: Date: Thu, 07 Oct 2004 13:53:16 +0000
Subject: Re: Re: Muti-Dimensional Array Help Please
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-198828@lists.php.net to get a copy of this message
* and then M. Sokolewicz declared.... > However, if it does matter, then I suggest a different way. This would Yes, 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) { > if(isset($ips[$i])) { > do_stuff($ips[$i]); > } else { > continue; > } > } > } > ?> 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.. -- Nick W

« previous php.general (#198828) next »