超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<array_chunkarray_count_values>
Last updated: Fri, 22 Jun 2007

array_combine

(PHP 5)

array_combine --  创建一个数组,用一个数组的值作为其键名,另一个数组的值作为其值

说明

array array_combine ( array keys, array values)

返回一个 array,用来自 keys 数组的值作为键名,来自 values 数组的值作为相应的值。

如果两个数组的单元数不同或者数组为空时返回 FALSE

例子 1. 简单的 array_combine() 例子

<?php
$a
= array('green','red','yellow');
$b = array('avocado','apple','banana');
$c = array_combine($a, $b);

print_r($c);

/* Outputs:
Array
(
   [green]  => avocado
   [red]    => apple
   [yellow] => banana
)
*/
?>

参见 array_merge()array_walk()array_values()




add a note add a note User Contributed Notes
array_combine
aidan at php dot net
21-May-2004 10:15
This functionality is now implemented in the PEAR package PHP_Compat.

More information about using this function without upgrading your version of PHP can be found on the below link:

http://pear.php.net/package/PHP_Compat

<array_chunkarray_count_values>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22