I have load data from two different table "prod & size", in push.php all data from chosen product push into array.
My question is, how to push the data from "size" along with the "prod"?
I wonder if I merge those two arrays.
Merge Array
Moderator: General Moderators
Merge Array
Last edited by nitediver on Wed Jun 09, 2010 7:37 am, edited 1 time in total.
Re: Merge Array
Use the php function "array_merge()"
Example:
Output:
Example:
Code: Select all
<?php
$array1 = array("color" => "red", 2, 4);
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
$result = array_merge($array1, $array2);
print_r($result);
?>Array
(
[color] => green
[0] => 2
[1] => 4
[2] => a
[3] => b
[shape] => trapezoid
[4] => 4
)