I have this array $node->taxonomy
which puts out these data, if I var_dump()
it:
array(1) {
[4]=> object(stdClass)#21 (5) {
["tid"]=> string(1) "4"
["vid"]=> string(1) "4"
["name"]=> string(9) "Marketing"
["description"]=> string(0) ""
["weight"]=> string(1) "1"
}
}
how can I extract the element "name" from it?
This way:
$node->taxonomy[4]->name
$node->taxonomy[4]->name
As simple as:
$node->taxonomy[4]->name
<?php
echo $node->taxonomy[4]->name;
or if you don't know the number (or the number changes) but its the first element in the array you could use:
<?php
$x = current($node->taxonomy);
echo $x->name;