当前位置:Gxlcms > PHP教程 > 关于php减少数组维度的问题求大神支招

关于php减少数组维度的问题求大神支招

时间:2021-07-01 10:21:17 帮助过:7人阅读

php数组

Array
(
[jwc_grades] => Array
(
[0] => Array
(
[2012] => Array
(
[1] => Array
(
[term_point] => 3.5
[term_average] => 88
[grades] => Array
(
[0] => Array
(
[jwc_grade_id] => 5
[course] => 阿什顿
[point] => 2
[grade] => 1
)

                                    )                            )                    )            )        [1] => Array            (                [2012] => Array                    (                        [1] => Array                            (                                [term_point] => 3.5                                [term_average] => 88                                [grades] => Array                                    (                                        [0] => Array                                            (                                                [jwc_grade_id] => 6                                                [course] => 是电风扇等                                                [point] => 2                                                [grade] => 1                                            )                                    )                            )                    )            )        [2] => Array            (                [2012] => Array                    (                        [2] => Array                            (                                [term_point] => 3.5                                [term_average] => 88                                [grades] => Array                                    (                                        [0] => Array                                            (                                                [jwc_grade_id] => 7                                                [course] => 不错                                                [point] => 2                                                [grade] => 1                                            )                                    )                            )                    )            )

)

如何让它变成
Array
(
[jwc_grades] => Array
(

                [2012] => Array                    (                        [1] => Array                            (                                [term_point] => 3.5                                [term_average] => 88                                [grades] => Array                                    (                                        [0] => Array                                            (                                                [jwc_grade_id] => 5                                                [course] => 阿什顿                                                [point] => 2                                                [grade] => 1                                            )                                    )                            )                    )                [2012] => Array                    (                        [1] => Array                            (                                [term_point] => 3.5                                [term_average] => 88                                [grades] => Array                                    (                                        [0] => Array                                            (                                                [jwc_grade_id] => 6                                                [course] => 是电风扇等                                                [point] => 2                                                [grade] => 1                                            )                                    )                            )                    )                 [2012] => Array                    (                        [2] => Array                            (                                [term_point] => 3.5                                [term_average] => 88                                [grades] => Array                                    (                                        [0] => Array                                            (                                                [jwc_grade_id] => 7                                                [course] => 不错                                                [point] => 2                                                [grade] => 1                                            )                                    )                            )                    )

)
就是让它的第三维消失 减少一维

人气教程排行