Re: XML-RPC problem with array

From: Date: Tue, 01 Feb 2005 23:33:10 +0000
Subject: Re: XML-RPC problem with array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-207868@lists.php.net to get a copy of this message
Bambero wrote: > Hello > > I have compiled my php with --with-xmlrpc option to use xmlrpc server. > Everything works fine, but there is one problem. > > Array (indexed from 0): > $array[0] > $array[1] > $array[2] > is changed to xmlrpc 'array' type - thats ok. > > Array (with string indexes): > $array['ad'] > $array['sd'] > $array['rd'] > is changed to xmlrpc 'struct' type - thats ok too. > > But array (indexed from 1): > $array[1] > $array[2] > $array[3] > is changed to xmlrpc 'array' type. > > Is it possible to change this type to xmlrpc 'struct' type ? I'll bet that if you did: $array['1'] = 'whatever'; it would turn into a struct. The crucial difference being that your KEYS are strings in the ones that get turned into struct. I bet that you only need to set *ONE* array element key to a string if you can't change all of them: <?php //Force string key so XML uses struct, not array: $array['1'] = $array[1]; unset($array[1]); ?> No promise on what ORDER the key/values will come out if you do that -- If you care about order, you're gonna have to re-do the whole array, almost for sure. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#207868) next »