summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_merge_basic.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/array/array_merge_basic.phpt')
-rw-r--r--ext/standard/tests/array/array_merge_basic.phpt58
1 files changed, 58 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_merge_basic.phpt b/ext/standard/tests/array/array_merge_basic.phpt
new file mode 100644
index 0000000..c4dc696
--- /dev/null
+++ b/ext/standard/tests/array/array_merge_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test array_merge() function : basic functionality
+--FILE--
+<?php
+/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
+ * Description: Merges elements from passed arrays into one array
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Test basic functionality of array_merge()
+ */
+
+echo "*** Testing array_merge() : basic functionality ***\n";
+
+//indexed array
+$array1 = array ('zero', 'one', 'two');
+//associative array
+$array2 = array ('a' => 1, 'b' => 2, 'c' => 3);
+
+var_dump(array_merge($array1, $array2));
+
+var_dump(array_merge($array2, $array1));
+
+echo "Done";
+?>
+
+--EXPECTF--
+*** Testing array_merge() : basic functionality ***
+array(6) {
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+}
+array(6) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ int(2)
+ ["c"]=>
+ int(3)
+ [0]=>
+ string(4) "zero"
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+Done \ No newline at end of file