I have two arrays, both have numbers but are extracted in specific order from a database. So what I want to do is to sort one of them in a acceding mode and the second array rearrange it's values to correspond the first one. for instance
$firstarray=array(14,30,20);
$secondarray=array(4,2,3);
So in our example I need the first array to become (14,20,30) witch can be made with the sort function but the second also have to become (4,3,2) to correspond with the first array.
Any ideas?
You can use array_combine to make one array and then sort it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With