I have an array of one structure as shown below
$array1 = array(
[123] => array('1'=>'1','2'=>'3'),
[345] => array('1'=>'3','2'=>'5'),
[789] => array('1'=>'1','2'=>'5'),
[567] => array('1'=>'6','2'=>'5'),
);
and another array structure as $array2 = array(567,345,789,123);
Now I want to sort this file using the php sort function, I mean sorting the first array with the second so that it looks like the desired result. below
$array1 = array(
[567] => array('1'=>'6','2'=>'5'),
[345] => array('1'=>'3','2'=>'5'),
[789] => array('1'=>'1','2'=>'5'),
[123] => array('1'=>'1','2'=>'3'),
);
I want to get this desired result with any sort function that already exists.
Thank.
source
share