Possible Duplicate:
Merging PHP array, one as Keys the other as Values?
I have the following two arrays in PHP, which represent atmospheric gases and their compositions:
Array
(
[0] => nitrogen
[1] => argon
[2] => oxygen
[3] => carbon dioxide
)
Array
(
[0] => 78
[1] => 1
[2] => 21
[3] => 0
)
Is there an elegant way of obtaining the following array, a combination of keys and values:
Array
(
"nitrogen" => 78
"argon" => 1
"oxygen" => 21
"carbon dioxide" => 0
)
The methods I can think of involve loops, I don’t know if I’m complicating it. Is there a simple way?
array_combine(), simply: