按字母顺序排序多维数组的值



我需要按字母顺序对数组进行排序,所以结果应该是这样的:

Inn Zoo
Leo Ann
Leo Zes
Sun Yog

我看了所有这些例子,但不能适用于我下面的数组(老问题):

  • 数组按DESC顺序排序
  • 动态排序数组而不知道现有的尺寸
  • 按字母顺序排序数组
  • PHP:如何按字母顺序排序数组的值?

Array
(
    [1] => Array
        (
            [Inn] => Array
                (
                    [Zoo] => Inn Zoo
                )
        )
    [2] => Array
        (
            [Sun] => Array
                (
                    [Yog] => Sun Yog
                )
        )
    [3] => Array
        (
            [Leo] => Array
                (
                    [Zes] => Leo Zes
                )
        )
    [4] => Array
        (
            [Leo] => Array
                (
                    [Ann] => Leo Ann
                )
        )
)
array
(
    [0] => Inn|Zoo|Inn Zoo
    [1] => Sunn|Yog|Sun Yog
    [2] => Leo|Zes|Leo Ann
    [3] => Leo|Ann|Leo Zes
)
asort($list);
array
(
    [0] => Inn|Zoo|Inn Zoo
    [3] => Leo|Ann|Leo Zes
    [2] => Leo|Zes|Leo Ann
    [1] => Sunn|Yog|Sun Yog
)

相关内容

  • 没有找到相关文章