-1

我有这个数组结果,想根据名称排序

$arr = array
(0 => array
        (
            (name) => Medianas empresas
            (count) => 17
            [applied] => 
            [url] => /es/index.php?option=com_virtuemart&view=category&Itemid=230&usage=Medianas+empresas
        )

    1 => array
        (
            [name] => Grandes empresas y gobierno
            [count] => 8
            [applied] => 
            [url] => /es/index.php?option=com_virtuemart&view=category&Itemid=230&usage=Grandes+empresas+y+gobierno
        )

    2 => array
        (
            [name] => Microempresas
            [count] => 9
            [applied] => 
            [url] => /es/index.php?option=com_virtuemart&view=category&Itemid=230&usage=Microempresas
        )

)

结果应该是这样的,

$arr = array
(
       1 => array
        (
            [name] => Grandes empresas y gobierno
            [count] => 8
            [applied] => 
            [url] => /es/index.php?option=com_virtuemart&view=category&Itemid=230&usage=Grandes+empresas+y+gobierno
        )
       0 => array
        (
            (name) => Medianas empresas
            (count) => 17
            [applied] => 
            [url] => /es/index.php?option=com_virtuemart&view=category&Itemid=230&usage=Medianas+empresas
        )
    2 => array
        (
            [name] => Microempresas
            [count] => 9
            [applied] => 
            [url] => /es/index.php?option=com_virtuemart&view=category&Itemid=230&usage=Microempresas
        )

)
4

1 回答 1

0

想要的结果实际上与您所拥有的结果相同,因此,没有什么可做的。

如果您在想要的结果中混淆了索引 0 和 1,只需

sort($arr);

会做的工作。

于 2013-06-06T07:43:41.663 回答