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

WBOY
Release: 2016-07-13 10:02:56
Original
832 people have browsed it

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;>
Copy after login

The output results are as follows:

Array
(
[0] => foo
[1] => bar
)
Copy after login

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...
Related labels:
source:php.cn
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