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); 
?>/*w w w .j a  va2 s  .  c o  m*/

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