I have 2 arrays. Array1 looks something like this (which is just a small example, in reality it haves more then 408 rows):
Array
(
[0] => Array ( [536870925] => 34213897 )
[1] => Array ( [536870923] => 34213905 )
[2] => Array ( [536870923] => 34213913 )
[3] => Array ( [536870928] => 34213921 )
[4] => Array ( [536870926] => 34213929 )
[5] => Array ( [536870919] => 34213937 )
[6] => Array ( [536870918] => 34218041 )
[7] => Array ( [536870925] => 34218049 )
[8] => Array ( [536870929] => 34218057 )
[9] => Array ( [536870920] => 34218065 )
[10] => Array ( [536870920] => 34218073 )
)
And Array2 looks something like this and it has only 16 rows:
Array
(
[0] => 536870922
[1] => 536870923
[2] => 536870924
[3] => 536870925
[4] => 536870926
[5] => 536870927
[6] => 536870928
[7] => 536870929
[8] => 536870914
[9] => 536870915
[10] => 536870916
[11] => 536870917
[12] => 536870918
[13] => 536870919
[14] => 536870920
[15] => 536870921
)
All of the ids that are in array2 exist in array1.
Both array1 and array2 are collected trow snmp_get from two different indexes. I need to reorder the ids and tthir equivalent value from array1 to match the id order that are presented in array2.
I tried to use a foreach with array1 but using array2 as the controller something like this, obviously this did not work..
$i = 0;
foreach ($intmac_ids as $value) {
echo $value[$unique_mac_id[$i++]];
}
The output that I am looking for is like this:
Array
(
[0] => Array ( [536870923] => 34213905 )
[1] => Array ( [536870923] => 34213913 )
[2] => Array ( [536870925] => 34213897 )
[3] => Array ( [536870925] => 34218049 )
[4] => Array ( [536870926] => 34213929 )
[5] => Array ( [536870928] => 34213921 )
[6] => Array ( [536870929] => 34218057 )
[7] => Array ( [536870918] => 34218041 )
[8] => Array ( [536870919] => 34213937 )
[9] => Array ( [536870920] => 34218065 )
[10] => Array ( [536870920] => 34218073 )
)