/**
* Convert a string, number, or object into an array.
* Especially useful for objects such as those that
* come from simplexml_load_file(), etc.
*
* @param mixed $non_array
* Any string, number, or object.
*
* @return
* An "arrayified" version of $non_array. At minimum,
* this should always return an empty array.
*/
function arrayify($non_array) {
if (empty($non_array) && $non_array !== 0) {
return array();
}
return unserialize(serialize(json_decode(json_encode((array) $non_array), 1)));
}
Then use it like this to extract the JSON data:
$data = arrayify($bitcoin->listreceivedbyaccount());
print_r($data);