Use taxonomy_get_tree() to extract term names? I'm using the handy taxonomy_get_tree() function to, hopefully, just extract the list of term names within a vocabulary. Sounds simple enough, but I'm stumped. Running the following:

$tree = taxonomy_get_tree(2);
print_r($tree);


yields the following:

      Array
(
    [0] =&gt; stdClass Object
        (
            [tid] =&gt; 1
            [vid] =&gt; 2
            [name] =&gt; The First Term
            [description] =&gt; 
            [weight] =&gt; 0
            [guid] =&gt; 
            [depth] =&gt; 0
            [parents] =&gt; Array
                (
                    [0] =&gt; 0
                )

        )

    [1] =&gt; stdClass Object
        (
            [tid] =&gt; 2
            [vid] =&gt; 2
            [name] =&gt; The Second Term
            [description] =&gt; 
            [weight] =&gt; 1
            [guid] =&gt; 
            [depth] =&gt; 0
            [parents] =&gt; Array
                (
                    [0] =&gt; 0
                )

        )

)


Now all I want to do is pull out each of the name values. So I tried the following:

foreach($tree as $value){
    print($value['name']);
}


I'm returning a server error. I suspect it has something to do with that pesky stdClass Object thing.

So any ideas how I can extract just the names?
Nevermind... this works:

foreach($tree as $value){
    print($value-&gt;name);
}


Thankfully, it looks like I'm not the only idiot out there. Sigh...