Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $out=array(
- 1 => array('name'=>'Бананы','count'=>16),
- 2 => array('name'=>'Груши','count'=>12),
- 3 => array('name'=>'Яблоки','count'=>1),
- 4 => array('name'=>'Апельсины','count'=>1),
- 5 => array('name'=>'Мандарины','count'=>5),
- );
- $tmp=array();
- foreach($out as $item){
- $tmp['name'][]=$item['name'];
- $tmp['count'][]=$item['count'];
- }
- array_multisort($tmp['count'],SORT_ASC,$out);//,$tmp['sort'],SORT_DESC,$out);
- print_r($out);
- /*
- Array
- (
- [0] => Array
- (
- [name] => Апельсины
- [count] => 1
- )
- [1] => Array
- (
- [name] => Яблоки
- [count] => 1
- )
- [2] => Array
- (
- [name] => Мандарины
- [count] => 5
- )
- [3] => Array
- (
- [name] => Груши
- [count] => 12
- )
- [4] => Array
- (
- [name] => Бананы
- [count] => 16
- )
- )
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement