php类里面排序函数的写法
<?php
class test
{
public $a = [2,4,1,3,5];
public function cmp($a, $b)
{
return $a > $b;
}
public function show()
{
usort($this->a, array(__CLASS__, 'cmp'));
return $this->a;
}
};
$t = new test();
echo json_encode($t->show());