Annotation of embedaddon/php/ext/standard/tests/array/array_diff_ukey_variation8.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_diff_ukey() function : usage variation - Passing boolean indexed array
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
! 6: * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: echo "*** Testing array_diff_ukey() : usage variation ***\n";
! 11:
! 12: // Initialise function arguments not being substituted (if any)
! 13: $input_array = array(0 => '0', 1 => '1', -10 => '-10', 'true' => 1, 'false' => 0);
! 14: $boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF');
! 15:
! 16: function key_compare_func($key1, $key2)
! 17: {
! 18: return strcasecmp($key1, $key2);
! 19: }
! 20:
! 21: echo "\n-- Testing array_diff_ukey() function with boolean indexed array --\n";
! 22:
! 23: var_dump( array_diff_ukey($boolean_indx_array, $input_array, 'key_compare_func') );
! 24: var_dump( array_diff_ukey($input_array, $boolean_indx_array, 'key_compare_func') );
! 25:
! 26: ?>
! 27: ===DONE===
! 28: --EXPECTF--
! 29: *** Testing array_diff_ukey() : usage variation ***
! 30:
! 31: -- Testing array_diff_ukey() function with boolean indexed array --
! 32: array(0) {
! 33: }
! 34: array(3) {
! 35: [-10]=>
! 36: string(3) "-10"
! 37: ["true"]=>
! 38: int(1)
! 39: ["false"]=>
! 40: int(0)
! 41: }
! 42: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>