XML-RPC for PHP: version 1.0b9
Prev | Chapter 6. Helper functions | Next

# Easy use with PHP arrays

Dan Libby was kind enough to contribute two helper functions that make it easier to translate to and from PHP arrays. This makes it easier to deal with complex structures. At the moment support is limited to int, double, string, array and struct datatypes; note also that all PHP arrays are encoded as structs due to PHP not being able to tell the difference between a hash and a linear array.

These functions reside in `xmlrpc.inc`.

## xmlrpc_decode

``$arr=xmlrpc_decode`($xmlrpc_val);`

Returns a PHP array stuffed with the values found in the xmlrpcval `$xmlrpc_val`, translated into native PHP types.

## xmlrpc_encode

``$xmlrpc_val=xmlrpc_encode`($phpval);`

Returns an xmlrpcval populated with the PHP values in `$phpval`. Works recursively on arrays and structs. Note that there's no support for non-base types like base-64 values or date-times.

Prev | Home | Next
Helper functions | Up | Debugging aids