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, ∼2522🔥, 0💬
Popular Posts:
How to use "xsl-transform" Azure API Policy Statement? The "xsl-transform" Policy Statement allows y...
How to use "xsl-transform" Azure API Policy Statement? The "xsl-transform" Policy Statement allows y...
How to make application release build with Visual Studio 2017? If you want to make a final release b...
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...
How to build a PHP script to dump Azure AD 2.0 Authentication Response? If you are use the Azure-AD-...