0
這是我在這裏的第一篇文章,即時通訊正在研究一個來自學校的項目。和具有麻煩 即時從PHP多維數組轉換此:PHP:將多維數組轉換爲簡單數組
Array
(
[0] => Array
(
[Program_ID] => 1001
[Program_Name] => Computer Engineering
[Program_NumHours] => 200
[Curriculum_ID] => 101
)
[1] => Array
(
[Program_ID] => 1002
[Program_Name] => Civil Engineering
[Program_NumHours] => 200
[Curriculum_ID] => 102
)
[2] => Array
(
[Program_ID] => 1003
[Program_Name] => Electronics Engineering
[Program_NumHours] => 200
[Curriculum_ID] => 103
)
[3] => Array
(
[Program_ID] => 1004
[Program_Name] => Electrical Engineering
[Program_NumHours] => 200
[Curriculum_ID] => 104
)
)
我想該數組轉換成這樣:
Array
(
[0] => Array
(
[0] => 1001
[1] => Computer Engineering
[2] => 200
[3] => 101
)
[1] => Array
(
[0] => 1002
[1] => Civil Engineering
[2] => 200
[3] => 102
)
[2] => Array
(
[0] => 1003
[1] => Electronics Engineering
[2] => 200
[3] => 103
)
[3] => Array
(
[0] => 1004
[1] => Electrical Engineering
[2] => 200
[3] => 104
)
)
這個數據是從使用笨數據庫中獲取的。提前致謝。
我可能是盲目的,但您預期的結果有尺寸輸入相同的結構/數字 - 僅在按鍵「內部「數組已被更改。 – VolkerK
是的,我只是想將關聯數組轉換爲一個簡單的數組 –
請參閱http://stackoverflow.com/questions/15191903/convert-an-associative-array-to-a-simple-array-of-its-values -in-php – noahnu