Re: Going through 2 arrays at once
| From: | Jochem Maas | Date: | Tue, 23 May 2006 22:39:01 +0000 |
| Subject: | Re: Going through 2 arrays at once | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236779@lists.php.net to get a copy of this message | ||
Pavleck, Jeremy D. wrote:
Greetings, PHP Rookiethat explains why you may not have bumped into 'foreach' yet :-) ...
here with a quick question - how do I go through 2 arrays at once with different keys? I'd like to combine these 2 arrays into one: for ( $i = 0; $i < sizeof($logicalDrive); $i++) {something like: foreach ($arrLogDrive as $key => $val) { echo isset($logicalDrive[$key]) ? $logicalDrive[$key]: $value; }echo "$arrLogDrive[$i]<br />\n"; }for (reset($logicalDrive); $i = key($logicalDrive); next($logicalDrive)) {echo "$i: $logicalDrive[$i]<br />\n";}