So what I am doing is creating a function that will pass in what array to append to another array. Here is what I am "trying" to do:
Global $shirts;
Global $prices;
$shirts = array(
'Option1' => array(),
'Option2' => array(),
);
$prices = array(
'product1' => array(
'bronze' => 1,
'silver' => 2,
'gold' => 3,
),
'product2' => array(
'bronze' => 4,
'silver' => 5,
'gold' => 6,
),
);
function shirts($shirts_model) {
global $shirts;
global $prices;
foreach ($shirts => $shirt) {
$result = array_merge($shirt, $prices[$shirt_model]);
}
print_r($result);
}
shirts('product2');
so now the $shirts array would now look like:
$shirts = array(
'Option1' => array(
'bronze' => 4,
'silver' => 5,
'gold' => 6,
),
'Option2' => array(
'bronze' => 4,
'silver' => 5,
'gold' => 6,
),
);
with the "product2" array. Basically now I could call the shirts(); function and pass in any option to append that options array to the shirts array. But this approach is not working? I am getting a white screen and I dont think this is working.
Hope that made sense.