usort function in a class

后端 未结 6 1234
孤城傲影
孤城傲影 2020-12-24 06:13

I have a function which sorts data in a multidimensional array, as shown below:

 \"James\");  
         


        
6条回答
  •  旧时难觅i
    2020-12-24 06:46

    One thing to consider is that if the variable is passed to your method by reference, usort() appears to execute in the context of the referenced variable and not your current method. Therefore, you need to provide the full namespace in your class reference like so:

    usort($data, ['My\NameSpace\MyClass', 'order_new']); 
    

提交回复
热议问题