Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Merge Values of Two Arrays into a Single Array
How To Merge Values of Two Arrays into a Single Array? - PHP Script Tips - PHP Built-in Functions for Arrays
✍: 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
)
2007-04-21, 9952👍, 0💬
Popular Posts:
How do I install JUnit? First I will download the lastest version of JUnit. Then I will extract all ...
What will be printed as the result of the operation below: #define swap(a,b) a=a+b;b=a-b;a=a-b; void...
What Does a HTML Document Look Like? A HTML document is a normal text file with predefined tags mixe...
What are some advantages and disadvantages of Java Sockets? Advantages of Java Sockets: Sockets are ...
What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notif...