PHP格式多维对象选择下拉深度

How can I take the following and echo it as a beautiful formatted select drop down including '--' for each level?

Array
(
    [0] => stdClass Object
        (
            [id] => 2
            [user_id] => 6
            [title] => First Category
            [parent_id] => 0
        )

    [1] => stdClass Object
        (
            [id] => 4
            [user_id] => 6
            [title] => HTML Times
            [parent_id] => 0
        )

    [2] => stdClass Object
        (
            [id] => 5
            [user_id] => 6
            [title] => Email Ninja
            [parent_id] => 0
        )

    [3] => stdClass Object
        (
            [id] => 6
            [user_id] => 6
            [title] => Taco Night
            [parent_id] => 0
        )

    [4] => stdClass Object
        (
            [id] => 7
            [user_id] => 6
            [title] => SSH
            [parent_id] => 0
            [childs] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 10
                            [user_id] => 6
                            [title] => Root Commands
                            [parent_id] => 7
                        )

                    [1] => stdClass Object
                        (
                            [id] => 11
                            [user_id] => 6
                            [title] => Shell
                            [parent_id] => 7
                        )

                    [2] => stdClass Object
                        (
                            [id] => 12
                            [user_id] => 6
                            [title] => Linux
                            [parent_id] => 7
                        )

                    [3] => stdClass Object
                        (
                            [id] => 13
                            [user_id] => 6
                            [title] => Windows
                            [parent_id] => 7
                        )

                )

        )

    [5] => stdClass Object
        (
            [id] => 8
            [user_id] => 6
            [title] => Dinner Tonight
            [parent_id] => 0
            [childs] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 9
                            [user_id] => 6
                            [title] => Mexican
                            [parent_id] => 8
                            [childs] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [id] => 14
                                            [user_id] => 6
                                            [title] => Tacos
                                            [parent_id] => 9
                                        )

                                )

                        )

                )

        )

)

I know this topic is pretty heavily covered, but it's not making a whole lot of since to me. After two days of reading... and reading... and reading... I was finally able to get this data out of my database. Now, I can't seem to get it to echo out any deeper than the first category.

Thanks for the assistance and patience.

Here's how I'm getting the parents currently:

$level = 0;

$categories = $this->mycrate->build_categories();

    echo '<select class="input-block-level">';

    function RecursiveWrite($categories) {
        foreach ($categories as $category) {
            echo '<option value="'.$category->id.'">'.$category->title.'</option>';
            RecursiveWrite($category->parent_id);
        }
    }

    RecursiveWrite($categories);

    echo '</select>';
function RecursiveWrite($categories) {
    foreach ($categories as $category) {
        echo '<option value="'.$category->id.'">'.$category->title.'</option>';
        RecursiveWrite($category->childs);
    }
}

RecursiveWrite($categories);

Try that to start, the recursive part needs to be called on the children elements, not the parent ID.