php数组操作实例之连接数组
发布时间:2016-08-17 编辑:jiaochengji.com
本文介绍下,php数组操作实例之连接数组的例子,有需要的朋友参考下。
array_combine()函数会得到一个新数组,它由一组提交的键和对应的值组成。其形式为:
array array_combine(array keys,array values)
注意,两个输入数组必须大小相同,不能为空。
例子:
<?php //php数组连接 //by www.jbxue.com $name = array("apple", "banana", "orange"); $color = array("red", "yellow", "orange"); $fruit = array_combine($name, $color); print_r($fruit); // output // Array ( [apple] => red [banana] => yellow [orange] => orange ) ?>
您可能感兴趣的文章:
php数组操作实例之连接数组
php数组操作实例之合并数组
PHP extract(数组拆分)作用分析
php数组合并与拆分示例
php数组实例(数组合并/拆分/追加/查找)
php 判断数组维数的例子(一维,二维或多维)
php数组合并、追加与连接的方法(array_merge()、array_combine()函数)
js数组操作(js数组创建、js数组访问等)
php数组操作实例之求数组的交集
php数组操作实例之接合数组
上一篇:php数组编码转换的方法参考
下一篇:php数组操作实例之求数组的交集
[关闭]