0

I need all keys of an array to be the same. I know with php they can't, but I am trying to send an array to soap.

My array Looks like this.

array(     
[0] => Array
    (
        [SKU] => Special Day
        [Description] => Special Day
        [Quantity] => 3
    )

[1] => Array
    (
        [SKU] => The Legend Continues
        [Description] => The Legend Continues
        [Quantity] => 7
    )

[2] => Array
    (
        [SKU] => Blank Inside
        [Description] => Blank Inside
        [Quantity] => 1
    )
)

I am in need of this.

$auth = array(

'Shipment' => array(
  'Items' => array( 

      'Item'=> Array
       (
        [SKU] => Special Day
        [Description] => Special Day
        [Quantity] => 3
        )

       'Item' => Array
        (
        [SKU] => The Legend Continues
        [Description] => The Legend Continues
        [Quantity] => 7
        )

      'Item' => Array
       (
        [SKU] => Blank Inside
        [Description] => Blank Inside
        [Quantity] => 1
       )
   )
)

How can I turn the loop that makes the arrays into what i need?

I am using this to make the arrays now.

while (wpsc_have_cart_items()) : wpsc_the_cart_item(); 
    $items[] = array(
        'SKU' => wpsc_cart_item_name(),
        'Description' => wpsc_cart_item_name(),
        'Quantity' => wpsc_cart_item_quantity()
    );
endwhile;
Tom
  • 761
  • 3
  • 15
  • 33

0 Answers0