In php how does usort() function works

后端 未结 5 764
暖寄归人
暖寄归人 2020-12-01 05:54

I have looked at the php documentation, tutorials online and none of them how usort is actually working. I have an example i was playing with below.

$data =          


        
5条回答
  •  孤城傲影
    2020-12-01 06:16

    The function cmp itself doesn't do the sorting. It just tells usort if a value is smaller, equal or greater than another value. E.g. if $a = 5 and $b = 9 it will return 1 to indicate that the value in $b is greater than the one in $a.

    Sorting is done by usort.

提交回复
热议问题