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

1.1     ! misho       1: --TEST--
        !             2: array_uintersect(): Test return type and value for expected input 
        !             3: --FILE--
        !             4: <?php
        !             5: /*
        !             6: * proto array array_uintersect ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
        !             7: * Function is implemented in ext/standard/array.c
        !             8: */
        !             9: class cr {
        !            10:     private $priv_member;
        !            11:     function cr($val) {
        !            12:         $this->priv_member = $val;
        !            13:     }
        !            14:     static function comp_func_cr($a, $b) {
        !            15:         if ($a->priv_member === $b->priv_member) return 0;
        !            16:         return ($a->priv_member > $b->priv_member) ? 1 : -1;
        !            17:     }
        !            18: }
        !            19: $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),);
        !            20: $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
        !            21: $result = array_uintersect($a, $b, array("cr", "comp_func_cr"));
        !            22: var_dump($result);
        !            23: ?>
        !            24: --EXPECTF--
        !            25: array(3) {
        !            26:   ["0.1"]=>
        !            27:   object(cr)#%d (1) {
        !            28:     ["priv_member":"cr":private]=>
        !            29:     int(9)
        !            30:   }
        !            31:   [1]=>
        !            32:   object(cr)#%d (1) {
        !            33:     ["priv_member":"cr":private]=>
        !            34:     int(4)
        !            35:   }
        !            36:   [2]=>
        !            37:   object(cr)#%d (1) {
        !            38:     ["priv_member":"cr":private]=>
        !            39:     int(-15)
        !            40:   }
        !            41: }

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