ホームページ >バックエンド開発 >PHPチュートリアル >关于php减少数组维度的问题 求大神支招

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

WBOY
WBOYオリジナル
2016-06-02 11:33:581052ブラウズ

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
)

<code>                                    )                            )                    )            )        [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                                            )                                    )                            )                    )            )</code>

)

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

<code>                [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                                            )                                    )                            )                    )</code>

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

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。