Questions about array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr);;
太山遍雨河润千里
太山遍雨河润千里 2018-02-22 19:46:03
0
1
1532

This function should be

array_multisort(array1,sorting order,sorting type,array2,array3...)

So sort $name first, and then $age Sort, then sort $arr.

The final returned result is represented by print_r($arr), that is, only $arr is sorted.

It is not returned to $arr as the teacher said.

array_multisort($name,SORT_ASC,$age,SORT_DESC);

The result of sorting in this way is a sort that does not retain the corresponding relationship between the original key values,

print_r( $arr) in this case the output is a two-dimensional array sorted forward by name and reversely sorted by age.

太山遍雨河润千里
太山遍雨河润千里

reply all(1)
Rain

After repeated debugging, it was found that the $arr parameter of the array_multisort function is equivalent to appending the sorting changes made by the previous parameters to the
$arr ​​ontology array, because the array_multisort function is passed by value. When calling, the previous sorting operation is an operation on the copy. The $arr parameter is equivalent to a
reassignment, ensuring the change of the ontology. But it cannot be completely regarded as a reassignment operation, because when the $arr parameter is changed to a new array $newArr parameter, the system will report an error. It can be seen that the role of the $arr parameter is similar to that of reassignment. Assignment operation but not.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template