Annotation of embedaddon/php/ext/standard/tests/array/array_intersect_key_variation5.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_intersect_key() function : usage variation - Passing float indexed array
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
! 6: * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: echo "*** Testing array_intersect_key() : usage variation ***\n";
! 11:
! 12: // Initialise function arguments not being substituted (if any)
! 13: $input_array = array(0 => '0', 10 => '10' , -10 => '-10');
! 14: $float_indx_array = array(0.0 => '0.0', 10.5 => '10.5' , -10.5 => '-10.5', 0.5 => '0.5');
! 15:
! 16: echo "\n-- Testing array_intersect_key() function with float indexed array --\n";
! 17: var_dump( array_intersect_key($input_array, $float_indx_array) );
! 18: var_dump( array_intersect_key($float_indx_array,$input_array ) );
! 19: ?>
! 20: ===DONE===
! 21: --EXPECTF--
! 22: *** Testing array_intersect_key() : usage variation ***
! 23:
! 24: -- Testing array_intersect_key() function with float indexed array --
! 25: array(3) {
! 26: [0]=>
! 27: string(1) "0"
! 28: [10]=>
! 29: string(2) "10"
! 30: [-10]=>
! 31: string(3) "-10"
! 32: }
! 33: array(3) {
! 34: [0]=>
! 35: string(3) "0.5"
! 36: [10]=>
! 37: string(4) "10.5"
! 38: [-10]=>
! 39: string(5) "-10.5"
! 40: }
! 41: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>