我的多维数组命名$cs_map_data
如下:
Array
(
[2] => Array
(
[class_id] => 2
[class_name] => II
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 81
[subject_name] => 11 Engllish
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[3] => Array
(
[class_id] => 3
[class_name] => III
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 155
[subject_name] => Hidi
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 156
[subject_name] => 11 Maths
[subject_checked] => 0
[teacher_cs_id] =>
)
[2] => Array
(
[cs_map_id] => 157
[subject_name] => 11 Science
[subject_checked] => 0
[teacher_cs_id] =>
)
[3] => Array
(
[cs_map_id] => 158
[subject_name] => 11 Engllish
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[4] => Array
(
[class_id] => 4
[class_name] => IV
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 86
[subject_name] => Physics
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[6] => Array
(
[class_id] => 6
[class_name] => VI
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 144
[subject_name] => Mathematics
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 145
[subject_name] => Biology
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[7] => Array
(
[class_id] => 7
[class_name] => VII
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 129
[subject_name] => Physics
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 130
[subject_name] => Chemistry11
[subject_checked] => 0
[teacher_cs_id] =>
)
[2] => Array
(
[cs_map_id] => 131
[subject_name] => 11 Science
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[8] => Array
(
[class_id] => 8
[class_name] => VIII
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 67
[subject_name] => Hidi
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 68
[subject_name] => 11 Engllish
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[9] => Array
(
[class_id] => 9
[class_name] => IX
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 87
[subject_name] => Mathematics
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 88
[subject_name] => Hidi
[subject_checked] => 0
[teacher_cs_id] =>
)
[2] => Array
(
[cs_map_id] => 89
[subject_name] => 11 Science
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
)
如果您注意到,数组的键是[2],[3],[4],[6],[7],[8],[9]
. 这些键是我从其他开发人员定义的某些功能中获得的。现在我的要求是重命名这些键,即数组键应该是[0],[1],[2],[3],[4],[5],[6]
. 其他数组元素和其他键值对应该保持原样。我用谷歌搜索但无法得到解决方案。谁能帮我重新排序这些数组键?提前致谢。我需要的输出如下:
Array
(
[0] => Array
(
[class_id] => 2
[class_name] => II
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 81
[subject_name] => 11 Engllish
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[1] => Array
(
[class_id] => 3
[class_name] => III
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 155
[subject_name] => Hidi
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 156
[subject_name] => 11 Maths
[subject_checked] => 0
[teacher_cs_id] =>
)
[2] => Array
(
[cs_map_id] => 157
[subject_name] => 11 Science
[subject_checked] => 0
[teacher_cs_id] =>
)
[3] => Array
(
[cs_map_id] => 158
[subject_name] => 11 Engllish
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[2] => Array
(
[class_id] => 4
[class_name] => IV
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 86
[subject_name] => Physics
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[3] => Array
(
[class_id] => 6
[class_name] => VI
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 144
[subject_name] => Mathematics
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 145
[subject_name] => Biology
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[4] => Array
(
[class_id] => 7
[class_name] => VII
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 129
[subject_name] => Physics
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 130
[subject_name] => Chemistry11
[subject_checked] => 0
[teacher_cs_id] =>
)
[2] => Array
(
[cs_map_id] => 131
[subject_name] => 11 Science
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[5] => Array
(
[class_id] => 8
[class_name] => VIII
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 67
[subject_name] => Hidi
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 68
[subject_name] => 11 Engllish
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
[6] => Array
(
[class_id] => 9
[class_name] => IX
[class_checked] => 0
[class_subjects] => Array
(
[0] => Array
(
[cs_map_id] => 87
[subject_name] => Mathematics
[subject_checked] => 0
[teacher_cs_id] =>
)
[1] => Array
(
[cs_map_id] => 88
[subject_name] => Hidi
[subject_checked] => 0
[teacher_cs_id] =>
)
[2] => Array
(
[cs_map_id] => 89
[subject_name] => 11 Science
[subject_checked] => 0
[teacher_cs_id] =>
)
)
)
)