Home > Backend Development > PHP Tutorial > php基础之数组的合并、拆分、区别取值函数集_PHP

php基础之数组的合并、拆分、区别取值函数集_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 12:20:51
Original
974 people have browsed it

PHP数组的合并、拆分、区别取值函数集

都说PHP的数组功能很强大、只有真正用于项目工作当中才能够感受得到,至少我认为是,现在已慢慢的发觉其中的奥秘了……

合并数组有三个函数

1.array_combine()

携带两个参数数组,参数数组一的值作新数组的键,参数数组二的值作新数组的值。很简单。

例子:

$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
)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template