PHP merge arrays by value for 2 different array value -


i have tried merge 2 different arrays single array. can 1 me please?

i have array this

[0] (array)#2   [rank] "579"   [id] "1" [1] (array)#4   [rank] "251"   [id] "2"  [0] (array)#2   [size] "s"   [rank] "251" [1] (array)#15   [size] "l"   [rank] "579" 

i need this

[0] (array)#2   [size] "s"   [rank] "251"   [id] "1" [1] (array)#15   [size] "l"   [rank] "579"   [id] "1" 

untested, should work, or @ least close.

for ($array1 $key1 => $value1) {     ($array2 $key2 => $value2) {         if ($value1['rank'] == $value2['rank']) {             $result[$key1] = [$value2['size'], $value1['rank'], $value1['id']];         };     }; }; 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -