如果我有一個陣列獲取數組php中的密鑰,然後用鍵排序數組?
Array
(
[3] => Array
(
[0] => title = title dffgfghfdg
[1] => 2-title2
[2] => content = content 2
)
[1] => Array
(
[0] => title = title erer
[1] => 1-title1
[2] => content = content 1
)
[0] => Array
(
[0] => title = title sdfdf
[1] => 4-title4
[2] => content = content 4
)
[2] => Array
(
[0] => title = titledfdf df
[1] => 3-title3
[2] => content = content 3
)
)
,我將盡[1]是關鍵。因爲我會在[1]中對數組進行排序..?
可能會
Array
(
[2-title2] => Array
(
[0] => title = title dffgfghfdg
[1] => 2-title2
[2] => content = content 2
)
[1-title1] => Array
(
[0] => title = title erer
[1] => 1-title1
[2] => content = content 1
)
[4-title4] => Array
(
[0] => title = title sdfdf
[1] => 4-title4
[2] => content = content 4
)
[3-title3] => Array
(
[0] => title = titledfdf df
[1] => 3-title3
[2] => content = content 3
)
)
的話,我會用鑰匙排序? 謝謝
你的問題有點不清楚。你在問如何用非整數鍵對數組進行排序? – Will 2012-01-02 02:22:02