array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?
时不待我
时不待我 2017-08-09 21:27:25
0
15
2523

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr);This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

时不待我
时不待我

reply all(15)
Rain

After repeated debugging, we 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 called by value. The previous The sorting operation is the operation of the copy. The $arr parameter is equivalent to a
reassignment, which ensures 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.

Rain

will not appear redundant. The $name array and the $age array are separated from the two-dimensional array $arr array.
If you only use the sort() or asort() function to sort the $name array, only the elements of the $name array will be changed.
Sequence (the $name array is only a copy of a part of the $arr array, and changes in the copy will not cause changes to the ontology),
will not cause changes to the original two-dimensional array $arr. So if you are sorting multi-dimensional arrays, you should use the array_multisort function.
array_multisort() can be used to sort multiple arrays at once, or to sort multi-dimensional arrays according to a certain dimension or multiple dimensions. This example is the second way to sort
multi-dimensional arrays based on a certain dimension. array_multisort($name, SORT_ASC,$age,SORT_DESC,$arr) implements the sorting of the name attribute column, and the age attribute column
will be sorted accordingly. In this way, it can actually be written as array_multisort($name, SORT_ASC,$age,$arr). The result of removing SORT_DESC will not change, because it has no effect
. By default, it only works on the first array. The second one will change according to the first one (of course this is an operation for multi-dimensional arrays).

myfey

Yes,,,

If you think it’s a waste, you can use asort to sort it

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

CCIE

array_multisort($name,SORT_ASC,$age,SORT_DESC,$arr); This sentence is only valid for $name, but not for $age. So is it redundant to write $age?

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