Jump to content

Recommended Posts

I'm having difficulty sending array data over SOAP, I have my SOAP server set up and have been sending data find and dandy and my app is coming along nicely but I've just come across the following anomaly.

If I set:

$foo[a] = "test"
$foo[b] = "test"
return $foo;

The response at the other end will print_r as:

Array
(
    [a] => "test"
    [b] => "test"
)

This is what I expected. However, if I send:

$foo[50] = "test"
$foo[99] = "test"

It will print_r as:

Array
(
    [0] => "test"
    [1] => "test"
)

The numeric index has been reindexed from zero. However, if I do this:

$foo[50] = "test"
$foo[99] = "test"
$foo[a] = "test"

The response is NOT reindexed:

Array
(
    [50] => "test"
    [99] => "test"
    [a] => "test"
)

No amount of $foo["99"] making it a string type efforts will fix it, all the keys of the array could be stored as an INT then they are not sent and they are re-indexed at the other end.

Has anybody seen this problem before? I would like to use the keys to send ID values of users but I cannot if they will be reindexed!

Thanks for your time.

James
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.