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

PHP merge two 1D arrays

不言
不言Original
2018-04-14 09:21:2710127browse

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 ); ?>

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!

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
Previous article:php write log functionNext article:php write log function