Get item from json in PHP <p>How to get the "duration" value from the below json in PHP :</p> <pre><code>{ "kind": "youtube#videoListResponse", "etag": "\"6jI4SSPcXxEAc3i_1EQHOPi0Cvc/EGNSBh81ISlkeECbqD9xdh5C340\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 1 }, "items": [ { "kind": "youtube#video", "etag": "\"6jI4SSPcXxEAc3i_1EQHOPi0Cvc/yUebIRJfQ62Pq5XpRbqJHx7Xozo\"", "id": "7lCDEYXw3mM", "contentDetails": { "duration": "PT15M51S", "dimension": "2d", "definition": "hd", "caption": "true", "licensedContent": false, "contentRating": { "ytRating": "" } } } ] } </code></pre> <p>Tried many examples but either it results in object error or invalid index error ? </p>