Tools, FAQ, Tutorials:
Merging Two Arrays into a Single Array in PHP
How To Merge Values of Two Arrays into a Single Array in PHP?
✍: FYIcenter.com
You can use the array_merge() function to merge two arrays into a single array. array_merge() appends all pairs of keys and values of the second array to the end of the first array. Here is a PHP script on how to use array_merge():
<?php $lang = array("Perl", "PHP", "Java",); $os = array("i"=>"Windows", "ii"=>"Unix", "iii"=>"Mac"); $mixed = array_merge($lang, $os); print("Merged:\n"); print_r($mixed); ?>
This script will print:
Merged: Array ( [0] => Perl [1] => PHP [2] => Java [i] => Windows [ii] => Unix [iii] => Mac )
⇒ Using an Array as a Queue in PHP
⇐ Joining Keys and Values into an Array in PHP
2017-01-11, 1542👍, 0💬
Popular Posts:
How to use the "set-backend-service" Policy Statement for an Azure API service operation? The "set-b...
How to access Query String parameters from "context.Request.Url.Que ry"object in Azure API Policy? Q...
How To Read a File in Binary Mode in PHP? If you have a file that stores binary data, like an execut...
What is Azure API Management Developer Portal Admin? The Developer Portal Admin is an Azure Web port...
Where to find tutorials on HTML language? I want to know how to learn HTML. Here is a large collecti...