class Thread{
public static function __compare($thread_a, $thread_b){
return $thread_a->posts_numbers > $thread_b->posts_numbers ? 1 : ($thread_a->posts_numbers == $thread_b->posts_numbers ? 0 : -1);
}
}
usort($this->sorted_threads, array('Thread', '__compare'));
http://php.net/manual/en/function.usort.php
沒有留言:
張貼留言