I have two arrays that need to reflect the same order based on one particular value. My first array, $array1, is a series of integers, and I need the secondary arrays in $array2, which have these same integers as a value (along with a whole bunch of other data that I have left off here for brevity), to be re-sorted to reflect the order of the integers in $array1.
Currently I have:
$array1 = array(
[0] => 19,
[1] => 15,
[2] => 18,
[3] => 20
);
$array2 = array (
[0] => array (
[0] => 20,
[1] => 'Some other data.'
),
[1] => array (
[0] => 18,
[1] => 'Some other data.'
),
[2] => array (
[0] => 19,
[1] => 'Some other data.'
),
[3] => array (
[0] => 15,
[1] => 'Some other data.'
)
);
Desired sorting of $array2:
$array2 = array (
[0] => array (
[0] => 19,
[1] => 'Some other data.'
),
[1] => array (
[0] => 15,
[1] => 'Some other data.'
),
[2] => array (
[0] => 18,
[1] => 'Some other data.'
),
[3] => array (
[0] => 20,
[1] => 'Some other data.'
)
)