Pavleck, Jeremy D. wrote:
Greetings,
PHP Rookie 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";
}
The first array returns things that the OID in the second array
represent. I.E. $array = array( 1=> 'Controller Index:', 'Drive Index:',
Fault Tolerant Mode:', etc, etc);
While the second has the MIB name as the key, then the return value of
the snmpget:
CPQIDA-MIB::cpqDaLogDrvCntlrIndex.0.1: 0
CPQIDA-MIB::cpqDaLogDrvIndex.0.1: 1
CPQIDA-MIB::cpqDaLogDrvFaultTol.0.1: mirroring
What I'd like to do it replace CPQIDA-MIB::cpqDaLogDrvCntlrIndex.0.1
that gets displayed into the "Controller Index:" in the other array.
I hope this makes sense. Sorry if it's super simple to solve, but I
tried a few things, and googled a few things, but I must have not found
the right thing I was looking for, as I still can't figure it out.
Thank you very much!
JDP
Jeremy Pavleck
Network Engineer - Systems Management
IT Networks and Infrastructure
Direct Line: 612-977-5881
Toll Free: 1-888-CAPELLA ext. 5881
Fax: 612-977-5053
E-mail: jeremy.pavleck@xxxxxxxxxxx <mailto:jeremy.pavleck@xxxxxxxxxxx>
Capella University
225 South 6th Street, 9th Floor
Minneapolis, MN 55402
www.capella.edu <http://www.capella.edu/>
It sounds like you want to use a while loop and then iterate manually
through both arrays, iterating both arrays once per loop iteration.
Sorry if I've misunderstood the problem.
Regards, Adam Zey.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php