misulicus
misulicus

Reputation: 415

Get returned value from json_decode output

so take this as the url output from the browser.

{
 "data": {
  "detections": [
   [
    {
     "language": "en",
     "isReliable": false,
     "confidence": 0.5714286
    }
   ]
  ]
 }
}

now i need to get "en" value from the returned values i tried:

$from = $json->data->detections->language;

still none work. what am i missing here ?

$json = json_decode(file_get_contents($detect));

Upvotes: 3

Views: 1183

Answers (1)

zerkms
zerkms

Reputation: 254916

It is

$json->data->detections[0][0]->language;

Get var_dump($json); and see the actual structure

Upvotes: 7

Related Questions