summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_combine_variation6.phpt
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:39:08 -0400
commit993e1866df547532a05ab6db76c9ff5aefc9a3df (patch)
tree169d3bde0974235d3cde164786ef6f381a4749a7 /ext/standard/tests/array/array_combine_variation6.phpt
parent1f589a2bd44ba835ad1b009a5d83abd453724829 (diff)
downloadphp-993e1866df547532a05ab6db76c9ff5aefc9a3df.tar.gz
Imported Upstream version 5.2.6upstream/5.2.6
Diffstat (limited to 'ext/standard/tests/array/array_combine_variation6.phpt')
-rw-r--r--ext/standard/tests/array/array_combine_variation6.phpt53
1 files changed, 53 insertions, 0 deletions
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 000000000..94c7b4d66
--- /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--
+<?php
+/* Prototype : array array_combine(array $keys, array $values)
+ * Description: Creates an array by using the elements of the first parameter as keys
+ * and the elements of the second as the corresponding values
+ * Source code: ext/standard/array.c
+*/
+
+/*
+* Testing the behavior of array_combine() by passing array with
+* binary values for $keys and $values argument.
+*/
+
+echo "*** Testing array_combine() : binary safe checking ***\n";
+
+// array with binary values
+$arr_binary = array(b"hello", b"world");
+$arr_normal = array("hello", "world");
+
+// array with binary value for $keys and $values argument
+var_dump( array_combine($arr_binary, $arr_binary) );
+
+// array with binary value for $values argument
+var_dump( array_combine($arr_normal, $arr_binary) );
+
+// array with binary value for $keys argument
+var_dump( array_combine($arr_binary, $arr_normal) );
+
+echo "Done";
+?>
+--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