I have an array with values as follows:-
$Array1 = array("myfirst_value", "mysecond_value", "mythird_value"}
Now for my another array, the listing comes in randomly as follows:-
$Array2 = array
(
[4] => myfirst_value
[8] => myforth_value
[21] => mysecond_value
[7] => myfifth_value
[17] => mysixth_value
[20] => mythird_value
[16] => myseventh_value
)
What I am hoping to achieve is that the $Array2 gets sorted based on the order of values in $Array1.
So, I am hoping that $Array2 gets sorted and becomes:-
$Array2 = array
(
[4] => myfirst_value
[21] => mysecond_value
[20] => mythird_value
[7] => myfifth_value
[8] => myforth_value
[16] => myseventh_value
[17] => mysixth_value
)
Notice, the values of Array1 are sorted first and rest are just outputted without any order.
Thanks