1
比如我有數組是這樣的:PHP創建數組從價值的新數組,如果數組具有相同的價值
Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
[4] => 5
[5] => 5
[6] => 5
[7] => 6
[8] => 7
[9] => 8
[10] => 9
)
我的問題是,如何創造新的數組這樣。因此,創建新的陣列爲相同的值:
Array
(
[0] => Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
)
[1] => Array
(
[0] => 5
[1] => 5
[2] => 5
)
[2] => 6
[3] => 7
[4] => 8
[5] => 9
)
請幫助我和我的英語不好。
感謝@deceze ......非常感謝:) 但如何,如果相同的價值不僅1,例如1,1,1和5,5,5。這段代碼是一樣的嗎? – 2015-03-31 06:56:33