How to Concatenate two arrays in PHP?

With array_merge() to concatenate two arrays in PHP

Let's say

we have two arrays like 

$array1 = array('PHP','Framework');
$array2 = array('Laravel','Codeigniter');

 

Then concatenate above two arrays by array_merge() 
 

<!DOCTYPE html>
<html>
<body>
<?php
$nameArray1 = array('PHP','Framework');
$nameArray2 = array('Laravel','Codeigniter');
$result = array_merge($array1, $array2);
print_r($result);
?>
</body>
</html>

 

This will return below output

Array ( [0] => PHP [1] => Framework[2] => Laravel[3] => Codeigniter)

 


Subscribe For Daily Updates

Flutter Questions
Android Questions