Blogger Information
Blog 142
fans 5
comment 0
visits 130099
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
使用 array_merge 方法
php开发大牛
Original
1016 people have browsed it

该方法如果只给了一个数组并且该数组是数字索引的,则键名会以连续方式重新索引。所以只能适用于数字索引。

<?php

$arr = array(
 1 => 'apple',
 3 => 'banana',
 5 => 'orange'
);

print_r(array_merge($arr));

$arr1 = array(
 'name' => 'jerry',
 'age' => 16,
 'height' => '18cm'
);

print_r(array_merge($arr1));

输出结果:

[root@localhost php]# php array.php  
Array
(
 [0] => apple
 [1] => banana
 [2] => orange
)
Array
(
 [name] => jerry
 [age] => 16
 [height] => 18cm
)


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post