Skip to content
Advertisement

how to create associative array from NOAA data

I’m trying to convert this to an associative array with json_decode but I’m messing up somewhere.

$noaaRaw looks like:

JavaScript

How do I convert that to an associative array?

JavaScript

Advertisement

Answer

file returns an array of lines. You want to use file_get_contents to get a string to decode:

JavaScript

It is also possible after that, that you may need to enable allow_url_fopen.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement