Annotation of embedaddon/php/ext/standard/tests/array/array_intersect_key_variation7.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test array_intersect_key() function : usage variation - Passing null,unset and undefeined variable 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', 1 => '1' , -10 => '-10' , null => 'null'); 
        !            14: //get an unset variable
        !            15: $unset_var = 10;
        !            16: unset ($unset_var);
        !            17: 
        !            18: $input_arrays = array(
        !            19:       'null indexed' => array(NULL => 'null 1', null => 'null 2'),
        !            20:       'undefined indexed' => array(@$undefined_var => 'undefined'),
        !            21:       'unset  indexed' => array(@$unset_var => 'unset'),
        !            22: );
        !            23: 
        !            24: foreach($input_arrays as $key =>$value) {
        !            25:       echo "\n--$key--\n";
        !            26:       var_dump( array_intersect_key($input_array, $value) );
        !            27:       var_dump( array_intersect_key($value,$input_array ) );
        !            28: }      
        !            29: ?>
        !            30: ===DONE===
        !            31: --EXPECTF--
        !            32: *** Testing array_intersect_key() : usage variation ***
        !            33: 
        !            34: --null indexed--
        !            35: array(1) {
        !            36:   [""]=>
        !            37:   string(4) "null"
        !            38: }
        !            39: array(1) {
        !            40:   [""]=>
        !            41:   string(6) "null 2"
        !            42: }
        !            43: 
        !            44: --undefined indexed--
        !            45: array(1) {
        !            46:   [""]=>
        !            47:   string(4) "null"
        !            48: }
        !            49: array(1) {
        !            50:   [""]=>
        !            51:   string(9) "undefined"
        !            52: }
        !            53: 
        !            54: --unset  indexed--
        !            55: array(1) {
        !            56:   [""]=>
        !            57:   string(4) "null"
        !            58: }
        !            59: array(1) {
        !            60:   [""]=>
        !            61:   string(5) "unset"
        !            62: }
        !            63: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>