I'm trying to create a PHP page that pulls data from Forecast.io's API. For the daily view, they give the days up as numbers. I want info from today, so the number is a "0." My code looks like this:
<?php
echo '<h4>', round(($data->daily->data->0->apparentTemperatureMax)*5/9) , '°F</h4>';
echo '<h2>', round(($data->currently->apparentTemperature)*5/9) , '°F</h2>';
echo '<h4>', round(($data->daily->data->0->apparentTemperatureMin)*5/9) , '°F</h4>'; ?>`
Where it states the Min and Max temperature, the "0" is a part of the JSON format that forecast.io uses. However, PHP throws an error whenever I try this. The error:
Parse error: syntax error, unexpected '0' (T_LNUMBER), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wamp64\www\PHP Weather Widget\index.php on line 35
Is there any way to use the zero, or do I need to parse the data using another method to avoid this?
A sample file of the JSON data returned:https://darksky.net/dev/docs/forecast can be entered into this site: http://jsonviewer.stack.hu/ to view a tree view of the data returned. You can see the format by going to "daily->data."
Any help would be appreciated.