Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Set array keys to value of another arrays values

$
0
0

I have the following:

( [0] => 3 [1] => 2 [2] => 12 [3] => 6 [4] => 8 [5] => 7 [6] => 9 [7] => 10 [8] => 5 [9] => 4 ) 

I want to use the value of each of those as the key in:

( [0] => 7 [1] => 2 [2] => 10 [3] => 3 [4] => 5 [5] => 6 [6] => 11 [7] => 9 [8] => 4 [9] => 8 ) 

I've tried this:

foreach ($iOrder as $i){    $pOrder[$i] = $pOrder[$p];    $p++;}

I get this:

( [12] => 2 [10] => 6 [5] => 5 [4] => 7 ) 

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>