Ceci est mon premier article ici, je travaille actuellement sur un projet de l'école. et im ayant du mal à convertir ce php de tableau multidimensionnel:PHP: convertir un tableau multidimensionnel en un tableau simple
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
)
)
Je veux convertir ce tableau en ceci:
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
)
)
ces données était de la mettre en liberté base de données en utilisant CodeIgniter. Merci d'avance.
je peux être aveugle, mais votre résultat attendu a la même structure/nombre de dimensions que l'entrée - seules les touches du " "tableaux" internes ont été modifiés. – VolkerK
oui, je veux juste convertir le tableau associatif en un tableau simple –
Voir http://stackoverflow.com/questions/15191903/convert-an-associative-array-to-a-simple-array-of-its-values -in-php – noahnu