I'm attempting to retrieve the slug for any tag in the wordpress publish, now its likely to obtain all tag info using

$tag = wp_get_post_tags($post->ID);

More information about this around the Wordpress Docs

Applying this you need to get data came back such as this...

Array
(
   [0] => stdClass Object
       (
           [term_id] => 4
           [name] => tag2
           [slug] => tag2
           [term_group] => 0
           [term_taxonomy_id] => 4
           [taxonomy] => post_tag
           [description] => 
           [parent] => 0
           [count] => 7
       )

   [1] => stdClass Object
       (
           [term_id] => 7
           [name] => tag5
           [slug] => tag5
           [term_group] => 0
           [term_taxonomy_id] => 7
           [taxonomy] => post_tag
           [description] => 
           [parent] => 0
           [count] => 6
       )

)

Ok now what I would like may be the slug for that first item that ought to be the following

$tag[0]['slug']

However in so doing I buy this php error:

Cannot use object of type stdClass as array

Can someone let me know what I am doing wrong here? and what is the easiest method to obtain the slug data

Observe that the array consists of objects (cases of stdClass), not other arrays. Therefore the syntax is:

$tag[0]->slug