Solved

Combining an array and returning data....

Posted on 2008-10-01
3
234 Views
Last Modified: 2012-05-05
I have 2 arrays, one that looks like this:
<code>
$AltProductInfo[] = array(
                  'orderid' => $OrderID,
                  'affiliation' => '',
                  'total' => $result->fields['price'],
                  'tax' => '',
                  'paymentplan' => $payment_plans,
                  'shipping' => $result->fields['shipping_cost'],
                  'sku'=> $result->fields['sku'],
                  'quantity'=> $result->fields['quantity'],
                  'name'=> '',
                  'category'=> '',
                  'city'=> $billcity,
                  'state'=> $billstate,
                  'country'=> $billcountry
            );
</code>
It will usually have 4 or 5 elements to it.

and then another that looks like this:
(It will only have 1 element)
<code>
$OrderTotal[] = array(
                  'orderid' => $OrderID,
                  'affiliation' => '',
                  'total' => $result->fields['price'],
                  'tax' => ''
            );
</code>

Since a function can only return one value, I need to combine these into 1 array, and then be able to pull them out on the next page.

Thanks!
0
Comment
Question by:interclubs
  • 3
3 Comments
 
LVL 9

Expert Comment

by:khaledf
ID: 22619837
use multi dimensional arrays
0
 
LVL 9

Accepted Solution

by:
khaledf earned 500 total points
ID: 22619862
example
$newArray = array( arr1,arr2);
0
 
LVL 9

Expert Comment

by:khaledf
ID: 22619867
sorry
$newArray = array( $arr1,$arr2);
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot call a static method on an Eloquent object 6 33
tutorial for ebay api 3 35
website maintenance mode 1 17
parse url to form? 7 12
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question