From d5acf6ad81b06781f053a3dcbdf78bbba81f62de Mon Sep 17 00:00:00 2001 From: Raghubansh Kumar Date: Tue, 27 Nov 2007 15:17:07 +0000 Subject: [PATCH] New testcases for array_combine() function --- .../tests/array/array_combine_basic.phpt | 52 ++++ .../tests/array/array_combine_error1.phpt | 48 +++ .../tests/array/array_combine_error2.phpt | 53 ++++ .../tests/array/array_combine_variation1.phpt | 198 ++++++++++++ .../tests/array/array_combine_variation2.phpt | 198 ++++++++++++ .../tests/array/array_combine_variation3.phpt | 283 ++++++++++++++++++ .../tests/array/array_combine_variation4.phpt | 192 ++++++++++++ .../tests/array/array_combine_variation5.phpt | 186 ++++++++++++ .../tests/array/array_combine_variation6.phpt | 53 ++++ 9 files changed, 1263 insertions(+) create mode 100644 ext/standard/tests/array/array_combine_basic.phpt create mode 100644 ext/standard/tests/array/array_combine_error1.phpt create mode 100644 ext/standard/tests/array/array_combine_error2.phpt create mode 100644 ext/standard/tests/array/array_combine_variation1.phpt create mode 100644 ext/standard/tests/array/array_combine_variation2.phpt create mode 100644 ext/standard/tests/array/array_combine_variation3.phpt create mode 100644 ext/standard/tests/array/array_combine_variation4.phpt create mode 100644 ext/standard/tests/array/array_combine_variation5.phpt create mode 100644 ext/standard/tests/array/array_combine_variation6.phpt diff --git a/ext/standard/tests/array/array_combine_basic.phpt b/ext/standard/tests/array/array_combine_basic.phpt new file mode 100644 index 00000000000..5d855cfec68 --- /dev/null +++ b/ext/standard/tests/array/array_combine_basic.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_combine() function : basic functionality +--FILE-- + "a", 2 => 'b'); +$values_array = array(3 => 'c', 4 => "d"); +var_dump( array_combine($keys_array, $values_array) ); + +// mixed array for $keys and $values arguments +$keys_array = array(1, 2 => "b"); +$values_array = array(3 => 'c', 4); +var_dump( array_combine($keys_array, $values_array) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : basic functionality *** +array(2) { + [1]=> + int(3) + [2]=> + int(4) +} +array(2) { + ["a"]=> + string(1) "c" + ["b"]=> + string(1) "d" +} +array(2) { + [1]=> + string(1) "c" + ["b"]=> + int(4) +} +Done diff --git a/ext/standard/tests/array/array_combine_error1.phpt b/ext/standard/tests/array/array_combine_error1.phpt new file mode 100644 index 00000000000..aa5a1afe1b3 --- /dev/null +++ b/ext/standard/tests/array/array_combine_error1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test array_combine() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : error conditions *** + +-- Testing array_combine() function with Zero arguments -- + +Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing array_combine() function with more than expected no. of arguments -- + +Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing array_combine() function with less than expected no. of arguments -- + +Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt new file mode 100644 index 00000000000..c06fdb490a6 --- /dev/null +++ b/ext/standard/tests/array/array_combine_error2.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_combine() function : error conditions - empty array +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : error conditions specific to array_combine() *** + +-- Testing array_combine() function with empty arrays -- + +Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d +bool(false) + +-- Testing array_combine() function with empty array for $keys argument -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) + +-- Testing array_combine() function with empty array for $values argument -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) + +-- Testing array_combine() function by passing array with unequal number of elements -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/array/array_combine_variation1.phpt b/ext/standard/tests/array/array_combine_variation1.phpt new file mode 100644 index 00000000000..c69d4ebafd8 --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation1.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test array_combine() function : usage variations - unexpected values for 'keys' argument +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : Passing non-array values to $keys argument *** +-- Iteration 1 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_combine() expects parameter 1 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_combine() expects parameter 1 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_combine() expects parameter 1 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_combine() expects parameter 1 to be array, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_combine() expects parameter 1 to be array, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_combine() expects parameter 1 to be array, null given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_combine() expects parameter 1 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_combine_variation2.phpt b/ext/standard/tests/array/array_combine_variation2.phpt new file mode 100644 index 00000000000..e58893bae7a --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation2.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test array_combine() function : usage variations - unexpected values for 'values' argument +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : Passing non-array values to $values argument *** +-- Iteration 1 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 2 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 3 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 4 -- + +Warning: array_combine() expects parameter 2 to be array, integer given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: array_combine() expects parameter 2 to be array, double given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: array_combine() expects parameter 2 to be array, boolean given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 18 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: array_combine() expects parameter 2 to be array, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: array_combine() expects parameter 2 to be array, object given in %s on line %d +NULL +-- Iteration 22 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: array_combine() expects parameter 2 to be array, null given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: array_combine() expects parameter 2 to be array, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/array/array_combine_variation3.phpt b/ext/standard/tests/array/array_combine_variation3.phpt new file mode 100644 index 00000000000..737b96bd8ae --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation3.phpt @@ -0,0 +1,283 @@ +--TEST-- +Test array_combine() function : usage variations - different arrays +--FILE-- +22 +'single quoted string' +"double quoted string" +2222 != 1111.\t 0000 = 0000\n +EOT; + +// arrays passed to $keys argument +$arrays = array ( +/*1*/ array(1, 2), // with default keys and numeric values + array(1.1, 2.2), // with default keys & float values + array(false,true), // with default keys and boolean values + array(), // empty array +/*5*/ array(NULL), // with NULL + array("a\v\f","aaaa\r","b","b\tbbb","c","\[\]\!\@\#\$\%\^\&\*\(\)\{\}"), // with double quoted strings + array('a\v\f','aaaa\r','b','b\tbbb','c','\[\]\!\@\#\$\%\^\&\*\(\)\{\}'), // with single quoted strings + array("h1" => $blank_line, "h2" => $multiline_string, "h3" => $diff_whitespaces, $numeric_string), // with heredocs + + // associative arrays +/*9*/ array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values + array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values + array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values + array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value + array("one" => 1, 2 => "two", 4 => "four"), //mixed + + // associative array, containing null/empty/boolean values as key/value +/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null), + array(true => "true", false => "false", "false" => false, "true" => true), + array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''), + array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true), + array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6), + + // array with repetative keys +/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3) +); + +// loop through each sub-array within $arrays to check the behavior of array_combine() +// same arrays are passed to both $keys and $values +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + var_dump( array_combine($array, $array) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : Passing different types of arrays to both $keys and $values argument *** +-- Iteration 1 -- +array(2) { + [1]=> + int(1) + [2]=> + int(2) +} +-- Iteration 2 -- +array(2) { + [1]=> + float(1.1) + [2]=> + float(2.2) +} +-- Iteration 3 -- +array(2) { + [""]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 4 -- + +Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d +bool(false) +-- Iteration 5 -- +array(1) { + [""]=> + NULL +} +-- Iteration 6 -- +array(6) { + ["a "]=> + string(3) "a " + ["aaaa +"]=> + string(5) "aaaa +" + ["b"]=> + string(1) "b" + ["b bbb"]=> + string(5) "b bbb" + ["c"]=> + string(1) "c" + ["\[\]\!\@\#$\%\^\&\*\(\)\{\}"]=> + string(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" +} +-- Iteration 7 -- +array(6) { + ["a\v\f"]=> + string(5) "a\v\f" + ["aaaa\r"]=> + string(6) "aaaa\r" + ["b"]=> + string(1) "b" + ["b\tbbb"]=> + string(6) "b\tbbb" + ["c"]=> + string(1) "c" + ["\[\]\!\@\#\$\%\^\&\*\(\)\{\}"]=> + string(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" +} +-- Iteration 8 -- +array(4) { + [" +"]=> + string(1) " +" + ["hello world +The quick brown fox jumped over; +the lazy dog +This is a double quoted string"]=> + string(88) "hello world +The quick brown fox jumped over; +the lazy dog +This is a double quoted string" + ["hello + world +1111 != 2222 +heredoc +double quoted string. with different white spaces"]=> + string(88) "hello + world +1111 != 2222 +heredoc +double quoted string. with different white spaces" + ["11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +"]=> + string(90) "11 < 12. 123 >22 +'single quoted string' +"double quoted string" +2222 != 1111. 0000 = 0000 +" +} +-- Iteration 9 -- +array(3) { + ["one"]=> + string(3) "one" + ["two"]=> + string(3) "two" + ["three"]=> + string(5) "three" +} +-- Iteration 10 -- +array(3) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) +} +-- Iteration 11 -- +array(4) { + [10]=> + int(10) + [20]=> + int(20) + [40]=> + int(40) + [30]=> + int(30) +} +-- Iteration 12 -- +array(3) { + ["ten"]=> + string(3) "ten" + ["twenty"]=> + string(6) "twenty" + ["thirty"]=> + string(6) "thirty" +} +-- Iteration 13 -- +array(3) { + [1]=> + int(1) + ["two"]=> + string(3) "two" + ["four"]=> + string(4) "four" +} +-- Iteration 14 -- +array(2) { + ["null"]=> + string(4) "null" + [""]=> + NULL +} +-- Iteration 15 -- +array(4) { + ["true"]=> + string(4) "true" + ["false"]=> + string(5) "false" + [""]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 16 -- +array(2) { + ["emptys"]=> + string(6) "emptys" + [""]=> + string(0) "" +} +-- Iteration 17 -- +array(2) { + [""]=> + bool(false) + [1]=> + bool(true) +} +-- Iteration 18 -- +array(3) { + [4]=> + int(4) + [5]=> + int(5) + [6]=> + int(6) +} +-- Iteration 19 -- +array(3) { + [10]=> + int(10) + [20]=> + int(20) + [3]=> + int(3) +} +Done diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt new file mode 100644 index 00000000000..c5294afa809 --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation4.phpt @@ -0,0 +1,192 @@ +--TEST-- +Test array_combine() function : usage variations - associative array with different keys +--FILE-- + "0"), + array(1 => "1"), + array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), + + // arrays with float keys +/*5*/ array(2.3333 => "float"), + array(1.2 => "f1", 3.33 => "f2", + 4.89999922839999 => "f3", + 33333333.333333 => "f4"), + + // arrays with string keys +/*7*/ array('\tHello' => 111, 're\td' => "color", + '\v\fworld' => 2.2, 'pen\n' => 33), + array("\tHello" => 111, "re\td" => "color", + "\v\fworld" => 2.2, "pen\n" => 33), + array("hello", $heredoc => "string"), // heredoc + + // array with object, unset variable and resource variable +/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'), + + // array with mixed keys +/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, + $fp => 'resource', 133 => "int", 444.432 => "float", + @$unset_var => "unset", $heredoc => "heredoc") +); + +// array to be passsed to $arr2 argument +$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4", + "\tHello" => 111, 2.2, 'color', "Hello world" => "string", + "pen\n" => 33, new classA() => 11, 133 => "int"); + +// loop through each sub-array within $arrays to check the behavior of array_combine() +// same arrays are passed to both $keys and $values +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + var_dump( array_combine($array, $array) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : assoc array with diff keys to both $keys and $values argument *** + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d + +Warning: Illegal offset type in %s on line %d +-- Iteration 1 -- + +Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d +bool(false) +-- Iteration 2 -- +array(1) { + [0]=> + string(1) "0" +} +-- Iteration 3 -- +array(1) { + [1]=> + string(1) "1" +} +-- Iteration 4 -- +array(4) { + [1]=> + string(1) "1" + [2]=> + string(1) "2" + [3]=> + string(1) "3" + [4]=> + string(1) "4" +} +-- Iteration 5 -- +array(1) { + ["float"]=> + string(5) "float" +} +-- Iteration 6 -- +array(4) { + ["f1"]=> + string(2) "f1" + ["f2"]=> + string(2) "f2" + ["f3"]=> + string(2) "f3" + ["f4"]=> + string(2) "f4" +} +-- Iteration 7 -- +array(4) { + [111]=> + int(111) + ["color"]=> + string(5) "color" + [2]=> + float(2.2) + [33]=> + int(33) +} +-- Iteration 8 -- +array(4) { + [111]=> + int(111) + ["color"]=> + string(5) "color" + [2]=> + float(2.2) + [33]=> + int(33) +} +-- Iteration 9 -- +array(2) { + ["hello"]=> + string(5) "hello" + ["string"]=> + string(6) "string" +} +-- Iteration 10 -- +array(1) { + ["hello"]=> + string(5) "hello" +} +-- Iteration 11 -- +array(6) { + [1]=> + int(1) + [2]=> + float(2.2) + ["int"]=> + string(3) "int" + ["float"]=> + string(5) "float" + ["unset"]=> + string(5) "unset" + ["heredoc"]=> + string(7) "heredoc" +} +Done diff --git a/ext/standard/tests/array/array_combine_variation5.phpt b/ext/standard/tests/array/array_combine_variation5.phpt new file mode 100644 index 00000000000..b5dafb10159 --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation5.phpt @@ -0,0 +1,186 @@ +--TEST-- +Test array_combine() function : usage variations - associative array with different values +--FILE-- + 0), + array("1" => 1), + array("one" => 1, 'two' => 2, "three" => 3, 4 => 4), + + // arrays with float values +/*5*/ array("float" => 2.3333), + array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), + + // arrays with string values +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(1 => "hello", "heredoc" => $heredoc), + + // array with object, unset variable and resource variable +/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp), + + // array with mixed values +/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", + 'resource' => $fp, "int" => 133, "float" => 444.432, + "unset" => @$unset_var, "heredoc" => $heredoc) +); + + +// loop through each sub-array within $arrays to check the behavior of array_combine() +$iterator = 1; +foreach($arrays as $array) { + echo "-- Iteration $iterator --\n"; + var_dump( array_combine($array, $array) ); + $iterator++; +} + +// close the file resource used +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : assoc array with diff values to both $keys and $values argument *** +-- Iteration 1 -- + +Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d +bool(false) +-- Iteration 2 -- +array(1) { + [0]=> + int(0) +} +-- Iteration 3 -- +array(1) { + [1]=> + int(1) +} +-- Iteration 4 -- +array(4) { + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) +} +-- Iteration 5 -- +array(1) { + [2]=> + float(2.3333) +} +-- Iteration 6 -- +array(4) { + [1]=> + float(1.2) + [3]=> + float(3.33) + [4]=> + float(4.8999992284) + [33333333]=> + float(33333333.333) +} +-- Iteration 7 -- +array(4) { + [" Hello"]=> + string(6) " Hello" + ["col or"]=> + string(6) "col or" + [" world"]=> + string(7) " world" + ["pen +"]=> + string(4) "pen +" +} +-- Iteration 8 -- +array(4) { + ["\tHello"]=> + string(7) "\tHello" + ["col\tor"]=> + string(7) "col\tor" + ["\v\fworld"]=> + string(9) "\v\fworld" + ["pen\n"]=> + string(5) "pen\n" +} +-- Iteration 9 -- +array(2) { + ["hello"]=> + string(5) "hello" + ["Hello world"]=> + string(11) "Hello world" +} +-- Iteration 10 -- +array(3) { + ["Class A object"]=> + object(classA)#%d (0) { + } + [""]=> + NULL + ["Resource id #%d"]=> + resource(%d) of type (stream) +} +-- Iteration 11 -- +array(8) { + ["hello"]=> + string(5) "hello" + ["Class A object"]=> + object(classA)#%d (0) { + } + ["fruit"]=> + string(5) "fruit" + ["Resource id #%d"]=> + resource(%d) of type (stream) + [133]=> + int(133) + [444]=> + float(444.432) + [""]=> + NULL + ["Hello world"]=> + string(11) "Hello world" +} +Done diff --git a/ext/standard/tests/array/array_combine_variation6.phpt b/ext/standard/tests/array/array_combine_variation6.phpt new file mode 100644 index 00000000000..94c7b4d664a --- /dev/null +++ b/ext/standard/tests/array/array_combine_variation6.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test array_combine() function : usage variations - binary safe checking +--FILE-- + +--EXPECTF-- +*** Testing array_combine() : binary safe checking *** +array(2) { + ["hello"]=> + string(5) "hello" + ["world"]=> + string(5) "world" +} +array(2) { + ["hello"]=> + string(5) "hello" + ["world"]=> + string(5) "world" +} +array(2) { + ["hello"]=> + string(5) "hello" + ["world"]=> + string(5) "world" +} +Done