$json:
{
"https://google.com/": {
"share": {
"comments": 10,
"shares": 20
},
"id": "https://google.com/"
}
}
PHP from error below:
$url = "https://google.com/";
... json is fetched here and set as $json
$count = $json->$url->comments;
Error:
PHP Notice: Undefined property: stdClass::$comments in /mysite/public_html/wp-content/themes/theme/functions.php on line 797
My partial fix:
$count = $json->$url->share->comments;