php - array - Illegal string offset -
I am trying to display a single value from an array of values. If I use but when I changed my code to looks like json first print_r ($ arr) then this value shows
{"a": 14, "b": 3, "c": 61200, "d": ["2014- 04-22 12:00:06 "," 2014-04-23 12:00:06 "," 2014-04-24 12:00:06 "]}
echo $ arr-> An attempt was made to use a and
$ arr ['a'] it shows invalid string offset 'a' . How to get a single value from an array of values?
$ d = '{"a": 14, "b": 3, "c": 61200, "d": ["2014-04-22 12:00:06", "2014 -04-23 12:00:06" , "2014-04-24 12:00:06"]} '; $ J = json_decode ($ d); Echo '& lt; Pre & gt; '; Print_r ($ j); Counterpart $ j-> A;
Comments
Post a Comment