0

I have 2 arrays like those:

$a = array(152,32,113,47,53);

$b = array("a","w","lk","qw","ol");

I will sort $a by using asort() and I want to auto-sort the second array $b likewise $a.

How to do I?

3
  • so, what's the result you want? Commented Mar 13, 2011 at 6:15
  • I think he wants the same indexes after the sort on $a to be the same as $b? Commented Mar 13, 2011 at 6:15
  • PHP - Sort Two Arrays The Same Way Commented Feb 13 at 13:04

2 Answers 2

7

You can use array_multisort.

Sign up to request clarification or add additional context in comments.

Comments

3

https://www.php.net/manual/en/function.array-multisort.php

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.