I have problem with accessing an object (stdClass
) after json_decode
.
I don't know why there is problem with -
as part of th key. Here is my code:
$a = array('body'=>array('short-description'=>'its short description','detailed-description'=>'its detail descriptionb'),'title'=>'its a title');
$b = json_encode($a);
$c = json_decode($b);
var_dump($c->body->short-description);
The problem is I can't get the value of short-description because the key have -
.