0

3 次元配列で array_map を実行するにはどうすればよいですか? 最も内側の配列を「クリア」したい場所は?

次のようになります。

Array
(
    [1] => Array
        (
            [1] => Array
                (
                    [cat] => Hello!
                    [url] => hello
                )

            [5] => Array
                (
                    [cat] => Good job!
                    [url] => good-job
                )

    [2] => Array
        (
            [2] => Array
                (
                    [cat] => How are you?
                    [url] => how-are-you
                )

            [6] => Array
                (
                    [cat] => Running shoes
                    [url] => running-shoes
                )
        )
)

私はそれを次のようにしたい:

Array
(
    [1] => Array
        (
            [1] => Array
                (
                    [cat] => Hello!
                    [url] => hello
                )

            [2] => Array
                (
                    [cat] => Good job!
                    [url] => good-job
                )

    [2] => Array
        (
            [1] => Array
                (
                    [cat] => How are you?
                    [url] => how-are-you
                )

            [2] => Array
                (
                    [cat] => Running shoes
                    [url] => running-shoes
                )
        )

)

このソリューションPHP の配列要素のキーをリセットしますか? 私が間違っていなければ、「ただ」は2つの次元配列で機能します。

4

1 に答える 1