Home > Backend Development > PHP Tutorial > PHP merge two 1D arrays

PHP merge two 1D arrays

不言
Release: 2023-03-23 19:18:02
Original
10132 people have browsed it

The content of this article is about merging two one-dimensional arrays in PHP. Now I share it with you. Friends in need can refer to it


<?php
 $array1  = array( 0  =>  &#39;zero_a&#39; ,  2  =>  &#39;two_a&#39; ,  3  =>  &#39;three_a&#39; ); 
 $array2  = array( 1  =>  &#39;one_b&#39; ,  3  =>  &#39;three_b&#39; ,  4  =>  &#39;four_b&#39; ); 
 $result  =  $array1  +  $array2 ;
 var_dump ( $result ); ?>
Copy after login

Related recommendations:

php merge array function array_merge()


The above is the detailed content of PHP merge two 1D arrays. For more information, please follow other related articles on the PHP Chinese website!

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