(PHP 5)
array_combine — 创建一个数组,用一个数组的值作为其键名,另一个数组的值作为其值
$keys
      , array $values
      )
     返回一个 array,用来自
     keys 数组的值作为键名,来自
     values 数组的值作为相应的值。
    
keys
     Array of keys to be used. Illegal values for key will be converted to string.
values
     Array of values to be used
   返回合并的 array,如果两个数组的单元数不同则返回 FALSE。
  
   Throws E_WARNING if the number of elements in
   keys and values does not
   match.
  
| 版本 | 说明 | 
|---|---|
| 5.4.0 | Previous versions issued E_WARNINGand returnedFALSEfor empty arrays. | 
Example #1 一个 array_combine() 简单的例子
<?php
$a = array('green', 'red', 'yellow');
$b = array('avocado', 'apple', 'banana');
$c = array_combine($a, $b);
print_r($c);
?>
以上例程会输出:
Array
(
    [green]  => avocado
    [red]    => apple
    [yellow] => banana
)