PHP array_merge() Function Example

By Hardik Savani May 14, 2024 Category : PHP

Hello Friends,

In this short tutorial, we will share the quick and straightforward way to php array_merge() function example. let’s discuss about array_merge function in php example. if you want to see an example of php array array_merge function then you are in the right place. we will help you to give an example of php array merge function.

array_merge() function is a PHP Array function. it will take multiple array parameters as argument for merge it. array_merge() function will help to merge multiple array in php. so, let's see the simple example

Example:

index.php

<?php

$arrayOne = ["One", "Two", "Three"];

$arrayTwo = ["Four", "Five"];

$newArray = array_merge($arrayOne, $arrayTwo);

var_dump($newArray);

?>

Output:

array(5) {

[0]=> string(3) "One"

[1]=> string(3) "Two"

[2]=> string(5) "Three"

[3]=> string(4) "Four"

[4]=> string(4) "Five"

}

I hope it can help you...

Tags :
Shares