我有这个数组:
$animals = array(
'0' => array('name' => 'cat', 'order' => '2'),
'1' => array('name' => 'dog', 'order' => '1'),
'2' => array('name' => 'fish', 'order' => '3')
);
我想把它变成这样:
$animals = array(
'1' => array('name' => 'dog', 'order' => '1'),
'0' => array('name' => 'cat', 'order' => '2'),
'2' => array('name' => 'fish', 'order' => '3')
);
如您所见,我想根据order
键进行排序。这个怎么做?