You are here: Re: [PHP] XML-RPC problem with array « PHP « IT news, forums, messages
Re: [PHP] XML-RPC problem with array

Posted by Richard Lynch on 02/02/05 01:33

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация