开发者

access each value of associative array

开发者 https://www.devze.com 2023-02-22 08:01 出处:网络
hello how can i access or echo each element of this associative array Array ( [0] => Array ( [rule] => admin/user

hello how can i access or echo each element of this associative array

Array
(
    [0] => Array
        (
            [rule] => admin/user
            [title] => Users Management
     开发者_开发知识库       [target] => _parent
            [0] => Array
                (
                    [0] => Array
                        (
                            [rule] => admin/user/add
                            [title] => Add New User
                        )

                )

        )

    [1] => Array
        (
            [rule] => admin/category
            [title] => Category Mangement
            [target] => _parent
            [0] => Array
                (
                    [0] => Array
                        (
                            [rule] => admin/category/add
                            [title] => Add New Category
                        )

                )

        )

)

I want to know which loop will support this and how


I suppose that using array_walk_recursive(), with a callback function that would do an echo, would be quite a good solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消