top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is use of array_multisort in PHP?

+1 vote
290 views
What is use of array_multisort in PHP?
posted Jun 10, 2014 by Amanpreet Kaur

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Array_multisort is used to sort several arrays at once or sort multidimensional array by one or more dimensions. In this the associative (string) keys will be maintained but numeric keys will be reindexed.
e.g :
<?php
array1 = array(23,60,50,70);
array2 = array(2,3,6,5);
array_multisort(array1 , $array2);
Output:
1: var_dump(array1);
array(4)
{
[0] => int(23)
[1] => int(50)
[2] => int(60)
[3] => int(70)
}
var_dump(array2);
array(4)
{

[0] => int(2)

[1] => int(6)

[2] => int(3)

[3] => int(5)

}

?>

answer Jun 12, 2014 by Mohit Sharma
...