How to take only one element of an associative array

Asked

Viewed 291 times

0

I’m pulling from the Cosmos API the data of a product, it returns me a json that I converted to a string array using $array = json_decode($data);

When I execute var_dump($array) he returns it to me:

object(stdClass)#34 (15) {

["description"]=> string(58) "ABSORVENTE COM ABAS INTIMUS GEL C/32 TRI PROTECT SECA UNIT"

["gtin"]=> float(7896007544059)

["thumbnail"]=> string(57) "https://cdn-cosmos.bluesoft.com.br/products/7896007544059"

["price"]=> string(8) "R$ 11,99"

I would like to know how to get only the link of ["thumbnail"]?

1 answer

0


Try it this way: $array->thumbnail;

Since the true parameter was not passed in json_decode, it is returning an object.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.