Source Code:
(back to article)
<?php $arr1 = ["W3", "w3d"]; $arr2 = ["W3docs", "Computer science portal"]; // Getting the merged array in the first array itself. $arr1 = array_merge($arr1, $arr2); echo "arr1 Contents:"; // Using the for each loop to print all the array elements. foreach ($arr1 as $value) { echo $value . "\n"; } ?>
Result:
Report an issue