<?php
$jsonstr = ' {
"child": {
"": {
"rss": [{
"data": "\n \n",
"attribs": {
"": {
"version": "2.0"
}
},
"xml_base": "",
"xml_base_explicit": false,
"xml_lang": "",
"child": {
"": {
"channel": [{
"data": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ",
"attribs": [],
"xml_base": "",
"xml_base_explicit": false,
"xml_lang": "",
"child": {
"": {
"title": [{
"data": "Data name",
"attribs": [],
"xml_base": "",
"xml_base_explicit": false,
"xml_lang": ""
}]
}
}
}]
}
}
}]
}
}
}';
$json = json_decode($jsonstr, true);
print_r($json['child']['']['rss'][0]['child']['']['channel'][0]['child']['']['title']);
$json = json_decode($jsonstr);
print_r($json->child->{''}->rss[0]->child->{''}->channel[0]->child->{''}->title);
- Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
- Array
(
[0] => Array
(
[data] => Data name
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
Array
(
[0] => stdClass Object
(
[data] => Data name
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
[0] => Array
(
[data] => Data name
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
Array
(
[0] => stdClass Object
(
[data] => Data name
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
- Output for 5.6.38
- Array
(
[0] => Array
(
[data] => Data name
[attribs] => Array
(
)
[xml_base] =>
[xml_base_explicit] =>
[xml_lang] =>
)
)
Fatal error: Cannot access empty property in /in/kh37Y on line 45
Process exited with code 255.
preferences:
111.13 ms | 401 KiB | 152 Q