PHP - Array Array merge

Introduction

And we can merge two or more arrays into one with array_merge:

Demo

<?php
    $good = ['A', 'B', 'C']; 
    $bad = ['Q', 'V', 'P']; 
    $all = array_merge($good, $bad); 
    var_dump($all); 
?>/*from   ww w  . ja v  a 2 s . c om*/

Result

The keys of the second array are now different.

Both the arrays had the same numeric keys, and an array cannot have two values for the same key.

Related Topic