diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:39:08 -0400 |
commit | 993e1866df547532a05ab6db76c9ff5aefc9a3df (patch) | |
tree | 169d3bde0974235d3cde164786ef6f381a4749a7 /ext/standard/tests/array/array_merge_variation8.phpt | |
parent | 1f589a2bd44ba835ad1b009a5d83abd453724829 (diff) | |
download | php-993e1866df547532a05ab6db76c9ff5aefc9a3df.tar.gz |
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/standard/tests/array/array_merge_variation8.phpt')
-rw-r--r-- | ext/standard/tests/array/array_merge_variation8.phpt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_merge_variation8.phpt b/ext/standard/tests/array/array_merge_variation8.phpt new file mode 100644 index 000000000..a4cdea74f --- /dev/null +++ b/ext/standard/tests/array/array_merge_variation8.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test array_merge() function : usage variations - multi-dimensional arrays +--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 array_merge() with multi-dimensional arrays + */ + +echo "*** Testing array_merge() : usage variations ***\n"; + +$arr1 = array('zero', 'one', 'two', array(0)); +$arr2 = array(1, 2, 3); + +echo "\n-- Merge a two-dimensional and a one-dimensional array --\n"; +var_dump(array_merge($arr1, $arr2)); + +echo "\n-- Merge an array and a sub-array --\n"; +var_dump(array_merge($arr1[3], $arr2)); +var_dump(array_merge($arr2, $arr1[3])); + +echo "Done"; +?> + +--EXPECTF-- +*** Testing array_merge() : usage variations *** + +-- Merge a two-dimensional and a one-dimensional array -- +array(7) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + array(1) { + [0]=> + int(0) + } + [4]=> + int(1) + [5]=> + int(2) + [6]=> + int(3) +} + +-- Merge an array and a sub-array -- +array(4) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(0) +} +Done
\ No newline at end of file |