类的成员函数作为回调函数

usort 无法调用类成员作为回调函数

 

其他可回调的函数亦是如此!

 

static function cmp_fun($a, $b) {
    
$x_a = $a['number'];
    
$x_b = $b['number'];
    
if($x_a == $x_b){
        
return 0;
    }
}


 本例采用静态方法

 

usort($array,'classname::cmp_fun');   
 

相关文章:

  • 2021-11-17
  • 2021-09-30
  • 2022-12-23
  • 2022-02-03
  • 2021-08-29
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-26
  • 2021-06-11
  • 2022-02-23
  • 2022-12-23
  • 2021-12-04
  • 2021-05-24
  • 2022-12-23
相关资源
相似解决方案