monkeymatrix monkeymatrix - 2 years ago 115
PHP Question

Convert a Hashmap string into an array using PHP

I am using an API which returns data as a string in the following format:


I want to put this result in to a multi-dimensional PHP array, but since the input is a string, I can't think of a convenient way to convert this.

Is there a function that can automatically parse this data into an array as desired?

Answer Source

That's JSON, simple enough:

$array = json_decode($string, true);


    [] => Array
            [status] => available
            [classkey] => domcno

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download