I know there are lots of question regarding this but i want one line solution for this so can anyone tell me how can i do this. I want to get the specific key value in array. This is the array i am getting
$size = json_decode($pid[0]->dtls);
echo "<pre>";
print_r($size);
echo "</pre>";
stdClass Object
(
[size] => 0.5
[qty] => 1
[flavor] => choclate syrup
)
and this is what i am trying to do to echo it.
echo $size = $size["size"];
But i am getting this error
Fatal error: Cannot use object of type stdClass as array
what i want to echo is 0.5