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

1.1     ! misho       1: --TEST--
        !             2: Test array_intersect_key() function : usage variation - Passing Multi dimensional 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: $array1 = array(
        !            14: 
        !            15:          'first' => array('blue'  => 1, 'red'  => 2),
        !            16:               
        !            17:       'second' => array('yellow' => 7),
        !            18:               
        !            19:       'third' => array(0 =>'zero'),
        !            20: );
        !            21: 
        !            22: $array2 = array (
        !            23: 
        !            24:          'first' => array('blue'  => 1, 'red'  => 2,),
        !            25:               
        !            26:       'second' => array('cyan'   => 8),
        !            27:               
        !            28:       'fourth' => array(2 => 'two'), 
        !            29: );
        !            30: var_dump( array_intersect_key($array1, $array2) );
        !            31: var_dump( array_intersect_key($array2,$array1 ) ); 
        !            32: ?>
        !            33: ===DONE===
        !            34: --EXPECTF--
        !            35: *** Testing array_intersect_key() : usage variation ***
        !            36: array(2) {
        !            37:   ["first"]=>
        !            38:   array(2) {
        !            39:     ["blue"]=>
        !            40:     int(1)
        !            41:     ["red"]=>
        !            42:     int(2)
        !            43:   }
        !            44:   ["second"]=>
        !            45:   array(1) {
        !            46:     ["yellow"]=>
        !            47:     int(7)
        !            48:   }
        !            49: }
        !            50: array(2) {
        !            51:   ["first"]=>
        !            52:   array(2) {
        !            53:     ["blue"]=>
        !            54:     int(1)
        !            55:     ["red"]=>
        !            56:     int(2)
        !            57:   }
        !            58:   ["second"]=>
        !            59:   array(1) {
        !            60:     ["cyan"]=>
        !            61:     int(8)
        !            62:   }
        !            63: }
        !            64: ===DONE===

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