The get_the_tags()
function returns all the tags associated with a post
and if you use it inside the loop then you may use it like this:
$tags = get_the_tags();
But if you use it outside of the loop then you have to supply the ID
of the post for which you want to retrieve that tags, for example to get all the tags of post whose ID
is 10
:
$tags = get_the_tags(10);
Now you can loop $tags
like this:
foreach($tags as $tag)
{
echo $tag->name . ' ';
}
Read more on Codex.