Is there a better way of getting specific pieces of data from taxonomy_term_load()? I have a taxonomy that has several fields attached to it. If I do a taxonomy_term_load($tid) on a specific item, it returns a huge object with multiple levels of nested arrays. I know which "parent" item (i.e. field name) I want, so I can do something like this:

$track_tax = taxonomy_term_load($value);
var_dump($track_tax-&gt;field_track_icon);


But even this returns a lot of nested levels:

array(1) {
  ["und"]=&gt;
  array(1) {
    [0]=&gt;
    array(15) {
      ["fid"]=&gt;
      string(3) "702"
      ["alt"]=&gt;
      string(0) ""
      ["title"]=&gt;
      string(0) ""
      ["width"]=&gt;
      string(2) "36"
      ["height"]=&gt;
      string(2) "36"
      ["uid"]=&gt;
      string(1) "1"
      ["filename"]=&gt;
      string(24) "strategies_at_retail.jpg"
      ["uri"]=&gt;
      string(44) "public://track_icon/strategies_at_retail.jpg"
      ["filemime"]=&gt;
      string(10) "image/jpeg"
      ["filesize"]=&gt;
      string(4) "1129"
      ["status"]=&gt;
      string(1) "1"
      ["timestamp"]=&gt;
      string(10) "1338391429"
      ["type"]=&gt;
      string(5) "image"
      ["rdf_mapping"]=&gt;
      array(0) {
      }
      ["image_dimensions"]=&gt;
      array(2) {
        ["width"]=&gt;
        string(2) "36"
        ["height"]=&gt;
        string(2) "36"
      }
    }
  }
}


I know I can get the uri by doing something like this:

$uri = $track_tax-&gt;field_track_icon["und"][0]["uri");


Is there a better way? Some other function that will return specific pieces? Or do I need to address it level by level?
The field_get_items() function is very useful for this sort of thing. It doesn't produce shorter code, but it's more structured and a lot easier to get your head round than the endless arrays of data:

// Get the items for a particular field
$field_items = field_get_items('taxonomy_term', $track_tax, 'field_track_icon');

// Get the first item (fields can have multiple items so field_get_items always returns an array)
$first_item = array_shift($field_items);

// Get the URI
$uri = $first_item['uri'];


Using that method has the added benefit of automatic language negotiation, so you can avoid having to get that from context or just relying on 'und'.

I should also say the use of this function isn't limited to taxonomy terms; you can use it to get field values for any type of entity.