在PHP的,我有這種類型的數組(抱歉大的例子,但它是一個特定的排序):PHP:分選multidimensionnal陣列具有非恆定的數字鍵
[0] => Array
(
[title] => 1
[desc] => 2
)
[1] => Array
(
[title] => 1
[desc] => 3
)
[2] => Array
(
[title] => 1
[desc] => 2
[content] => 10
)
[3] => Array
(
[title] => 1
[desc] => 2
[content] => 11
)
[4] => Array
(
[title] => 1
[desc] => 3
[content] => 9
)
[5] => Array
(
[title] => 1
[desc] => 2
[content] => 10
[tag] => 'foo'
)
[6] => Array
(
[title] => 1
[desc] => 2
[content] => 10
[tag] => 'bar'
)
而且我想這樣的輸出:
[0] => Array
(
[title] => 1
[desc] => 2
)
[1] => Array
(
[title] => 1
[desc] => 2
[content] => 10
)
[2] => Array
(
[title] => 1
[desc] => 2
[content] => 10
[tag] => 'bar'
)
[3] => Array
(
[title] => 1
[desc] => 2
[content] => 10
[tag] => 'foo'
)
[4] => Array
(
[title] => 1
[desc] => 2
[content] => 11
)
[5] => Array
(
[title] => 1
[desc] => 3
)
[6] => Array
(
[title] => 1
[desc] => 3
[content] => 9
)
而且偏偏array_multisort()
無法排序與非恆定的數字鍵的排列:它只是忽略了所有的數組... 任何想法?
檢查usort ..... ... – xdazz