Note that the array contains objects (instances of stdClass), not other arrays. So the syntax is:
stdClass
$tag[0]->slug
Another option should be to explicitly cast $tag[0] into an array:
$t = (array)$tag[0];$t["slug"] = ...
Can't get it to work though