Outputting a specific index of an array
-
I want to be able to output the content of “name” index and nothing else. So for the one below, I would see “Electrical” output to the screen.
So something like:
If $test is the array name.
echo $test->name;
Array ( [0] => stdClass Object ( [term_id] => 13 [name] => Electrical [slug] => electrical [term_group] => 0 [term_taxonomy_id] => 13 [taxonomy] => category [description] => [parent] => 0 [count] => 9 [object_id] => 172 [cat_ID] => 13 [category_count] => 9 [category_description] => [cat_name] => Electrical [category_nicename] => electrical [category_parent] => 0 ) [1] => stdClass Object ( [term_id] => 21 [name] => NEWS [slug] => news [term_group] => 0 [term_taxonomy_id] => 21 [taxonomy] => category [description] => [parent] => 0 [count] => 3 [object_id] => 172 [cat_ID] => 21 [category_count] => 3 [category_description] => [cat_name] => NEWS [category_nicename] => news [category_parent] => 0 ) )
- The topic ‘Outputting a specific index of an array’ is closed to new replies.