Hi i have 3 array
Date Array
array(
0 => array("date_1" => "06-09-2010"),
1 => array("date_2" => "07-09-2010"),
2 => array("date_3" => "08-09-2010")
)
Day Array
array(
0 => array("day_1" => "Monday"),
1 => array("day_2" => "Tuesday"),
2 => array("day_3" => "Wednesday")
)
Period Array
array(
0 => array("period_1" => "1"),
1 => array("period_2" => "1"),
2 => array("period_3" => "1")
)
How can i alter/merge the array so the array will become something like this?
array 0 = date_1,day_1, period_1
array 1 = date_2,day_2, period_2
array 2 = date_3,day_3, period_3
Using array merge will return something like this
array(
0 => array("date_1" => "06-09-2010"),
1 => array("date_2" => "07-09-2010"),
2 => array("date_3" => "08-09-2010"),
3 => array("period_1" => "1"),
4 => array("period_2" => "1"),
5 => array("period_3" => "1"),
6 => array("day_1" => "Monday"),
7 => array("day_2" => "Tuesday"),
8 => array("day_3" => "Wednesday")
)
Edited (Answer)
The problem can be solve using this function. Thanks Codaddict!
$date = array(
array('date_1'=>"06-09-2010"),
array('date_2'=>"07-09-2010"));
$day = array(
array("day_1"=>"Monday"),
array("day_2"=>"Tuesday")
);
$period = array(
array("period_1"=>1),
array("period_2"=>2)
);
$result = array();
for($i=0;$i<count($date);$i++) {
array_push($result,array($data[$i],$day[$i],$period[$i]));
}
var_dump($result);