Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/21/2022 in all areas

  1. $data is an array with one element that is an array. That array has a lot of elements including the one you say you want. So try: <?php foreach ($data[0]['lastData'] as $key => $key_value) { echo "key: $key, value: $key_value <br>"; } Once you have figured out which keys you actually want, you should be able to access them more directly. So for example: echo "<p>Temperature (F): {$data[0]['lastData']['tempinf']}</p>"; echo "<p>Wind (mph): {$data[0]['lastData']['windspeedmph']}</p>"; I don't see a min/max temp value in the data you provided. Aside from 'lastData', there are several other keys and nested arrays in some cases. For figuring this out in the future, aside from var_dump, print_r is often a useful development/debugging function that can be used as an alternative.
    1 point
  2. Update. Just did a little testing and surprisingly PHP doesn't error out if you use too many args in a call, only when you use too few args. Another learning moment.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.