Re: Going through 2 arrays at once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pavleck, Jeremy D. wrote:
 Greetings,

PHP Rookie

that 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++) {
echo "$arrLogDrive[$i]<br />\n"; }

for (reset($logicalDrive); $i = key($logicalDrive); next($logicalDrive))
{
        echo "$i: $logicalDrive[$i]<br />\n";
}

something like:

foreach ($arrLogDrive as $key => $val) {
	echo isset($logicalDrive[$key]) ? $logicalDrive[$key]: $value;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux