Annotation of embedaddon/php/ext/standard/tests/array/array_combine_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_combine() function : usage variations - binary safe checking
3: --FILE--
4: <?php
5: /* Prototype : array array_combine(array $keys, array $values)
6: * Description: Creates an array by using the elements of the first parameter as keys
7: * and the elements of the second as the corresponding values
8: * Source code: ext/standard/array.c
9: */
10:
11: /*
12: * Testing the behavior of array_combine() by passing array with
13: * binary values for $keys and $values argument.
14: */
15:
16: echo "*** Testing array_combine() : binary safe checking ***\n";
17:
18: // array with binary values
19: $arr_binary = array(b"hello", b"world");
20: $arr_normal = array("hello", "world");
21:
22: // array with binary value for $keys and $values argument
23: var_dump( array_combine($arr_binary, $arr_binary) );
24:
25: // array with binary value for $values argument
26: var_dump( array_combine($arr_normal, $arr_binary) );
27:
28: // array with binary value for $keys argument
29: var_dump( array_combine($arr_binary, $arr_normal) );
30:
31: echo "Done";
32: ?>
33: --EXPECTF--
34: *** Testing array_combine() : binary safe checking ***
35: array(2) {
36: ["hello"]=>
37: string(5) "hello"
38: ["world"]=>
39: string(5) "world"
40: }
41: array(2) {
42: ["hello"]=>
43: string(5) "hello"
44: ["world"]=>
45: string(5) "world"
46: }
47: array(2) {
48: ["hello"]=>
49: string(5) "hello"
50: ["world"]=>
51: string(5) "world"
52: }
53: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>