Monday, March 12, 2018

JSON to PHP variable with integer

I've got this JSON Output:



{"ok":true,"license":"CC BY 4.0 -  http:\/\/creativecommons.tankerkoenig.de","data":"MTS-K","prices":{"90d20149-1047-43d3-9b80-4c6f7fd22499":{"status":"open","e5":1.479,"e10":1.459,"diesel":1.259}}}


and I want to get the values of e5, e10 and diesel into a PHP Variable. Like:



$Tankstelle = json_decode($json);
$PriceE5 = (float)utf8_decode($Tankstelle->prices->90d20149-1047-43d3-9b80-4c6f7fd22499->e5);



But it doesnt work, as there is this integer as a value. Can you help me? Thank you!

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...