Home  >  Article  >  Backend Development  >  PHP uses the array_merge() function to merge associative and non-associative arrays, array_merge array_PHP tutorial

PHP uses the array_merge() function to merge associative and non-associative arrays, array_merge array_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:02:56825browse

php uses the array_merge() function to merge associative and non-associative arrays, array_merge array

This article describes the example of php using the array_merge() function to merge associative and non-associative arrays . Share it with everyone for your reference. The specific analysis is as follows:

array_merge() is a php function used to merge arrays. The latter array is appended to the end position of the previous one and returns the merged result array.

<&#63;php
$beginning = 'foo';
$end = array(1 => 'bar');
$result = array_merge((array)$beginning, (array)$end);
print_r($result);
&#63;>

The output results are as follows:

Array
(
[0] => foo
[1] => bar
)

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/969485.htmlTechArticlephp method of merging associative and non-associative arrays through the array_merge() function, array_merge array This article describes the example of php through array_merge The () function combines associative and non-associative arrays. Points...
Statement:
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