I have the following code:
$json = ' {
"HTML":
[
{
"id": 1,
"name": "HTML",
"match": false
},
{
"id": 2,
"name": "HTML 5",
"match": false
},
{
"id": 3,
"name": "XHTML",
"match": false
}
]
}';
$obj = json_decode($json);
$obj[0][0]->name; // JavaScript: The Definitive Guide
Why do I get the following error?
use object of type stdClass as array
I decode the json correctly, than I say that I want to pick the first object from the array (in this case HTML) and than I want to pick the name of the first one in the array.
What is going wrong?