Merging Two Arrays in PHP


Combine two arrays into one with array_merge().

Source Code

$array1 = ["apple", "banana"];
$array2 = ["cherry", "date"];
$merged = array_merge($array1, $array2);
print_r($merged); // Combines the two arrays
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments