Hi, I've currently got a hierarchical term list that I've output as plain text. But I would now like to add links to a views table filter as I don't like the teaser view and can't easily adapt it. The problem is the way the terms are stored.

They are currently stored as 1, 2, 3, 4, but I need to display them as 4, 3, 2, 1, so I can't use a foreach loop (which I really want to!) as it'll be the wrong way round. I've overcome this by exploding the array and outputting them in reverse:

$taxon=explode("<br />",$node->field_species[0]['view']);
print $taxon[3]."<br>";
print $taxon[2]."<br><i>";
print $taxon[1]."<br>";
print $taxon[0]."<br></i>";

This doesn't let me output tid which I could add to a views argument /browse?filter0=. Ideally I want to use something like below, but like I said, this is the wrong way round:

foreach ((array)$field_species[0] as $taxon){
print $taxon->name."<a href='/browse?filter0=".$taxon->tid."'</a><br>";
}

Is there some way to extract the tids so I can add them in reverese? Or can you output from an array in reverse?

Thanks
Matt