Who can tell me what the values of these two parameters are and where they come from. Why can this function be sorted when written like this? I have been thinking about it all night and I don’t understand.
YHF2018-08-30 15:59:49
$var1 and $var2 are two adjacent key values in the $arr array. Each time, the two adjacent key values are compared, that is, key value 1 is first compared with key value 2, and after the comparison, the key value is 2 is compared with key value 3, and so on, all the way to the end of the array.
墨尘致远2018-08-28 11:50:04
usort is a built-in function in PHP. usort() allows users to sort arrays using custom functions.
usort compares two elements each time and obtains the return value for sorting. 0, -1, and 1 represent equal, less than, and greater respectively.