PHP array_merge() Function Example
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...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Remove String Keys in PHP Array?
- How to Remove Numeric Keys in PHP Array?
- How to Remove String Values in PHP Array?
- How to Remove Numeric Values in PHP Array?
- How to Get First 10 Elements of Array in PHP?
- How to Get First 5 Elements of Array in PHP?
- How to Get First 3 Elements of Array in PHP?
- How to Get First 2 Elements of Array in PHP?
- How to Get Maximum Key Value of Array in PHP?
- How to Remove Empty Values from Array in PHP?
- How to Add Prefix in Each Key of PHP Array?
- How to Get Minimum Key Value of Array in PHP?
- How to Remove Null Values from Array in PHP?