Just a real quick question please, I have this string that came from my query
I am able to display the string using xx = dd($sumx)
which gave me the string below:
string(124) "[{"total":-4107717.58,"alerx":4,"currentYear":-4107717.58,"lastYear":0,"date":2015,"value":{"debit":0,"credit":4107717.58}}]"
in order for me to access it via '->' notation, like an object. I convert it using json_decode()
I echoed it again and gives me this object format:
array(1) {
[0]=>
object(stdClass)#508 (6) {
["total"]=>
float(-4107717.58)
["alerx"]=>
int(4)
["currentYear"]=>
float(-4107717.58)
["lastYear"]=>
int(0)
["date"]=>
int(2015)
["value"]=>
object(stdClass)#509 (2) {
["debit"]=>
int(0)
["credit"]=>
float(4107717.58)
}
}
}
when I tried to access $sumx->value
it then gives me a `Trying to get property of non-object
I tried accessing it via $sumx[0]->value
same error, I also tried validating the string to http://jsonlint.com/ and it says its valid. Can someone point out to me whats wrong please. Thanks for the time and have a good day.