douyan1972
2013-08-28 23:07
浏览 69
已采纳

PHP Array_multisort状态

I'm trying to multisort a DB array based on the users status. Those with Status = 1 go at the top, those with Status = 0 go at the bottom of the array. I thought I had it working but it just stopped today with the addition of new rows to the DB.

uasort($ven, function ($a, $b) { return $a['v_status'] == '1' ? false : true; });

It's a simple DB array from MySQL:

Array (
 [0] => array(
   [name] => '',
   [v_status] => 0
 [1] => array(
   [name] => '',
   [v_status] => 1
)

2条回答 默认 最新

相关推荐 更多相似问题