PHP/Data Structure/array combine
array_combine
<?php
$abbreviations = array("AL","AK","AZ","AR");
$states = array("Alabama","Alaska","Arizona","Arkansas");
$stateMap = array_combine($abbreviations,$states);
print_r($stateMap);
?>
Combining Arrays
<?php
$colors = array("red", "yellow", "green");
$flavors = array("apple", "banana", "lime");
$tastes = array("sweet", "sour");
$prices = array();
$name = "lemon";
$arrays = array("name" => $name, "prices" => $prices, "flavors" => $flavors);
foreach($arrays as $key => $value) {
if($fruits = @array_combine($colors, $value))
printf("<pre>%s</pre>\n", var_export($fruits, TRUE));
else
printf("<p>Couldn"t combine \$colors and \$%s.</p>", $key);
}
?>