public static function intersection($array)
    {
        if ($array == null)
            return [];

        $args = func_get_args();
        $argsLength = func_num_args();

        if ($argsLength == 1)
            return $array;

        if (static::every($args, 'is_array'))
            return array_values(call_user_func_array('array_intersect', $args));

        $arrayLenght = static::size($array);
        $result = [];
        static::each($array, function($value, $index) use (& $result, $args, $argsLength) {
            if (static::contains($result, $value))
                return;

            for ($i=1; $i<$argsLength; $i++)
                if (!static::contains($args[$i], $value))
                    break;

            if ($i == $argsLength)
                $result[] = $value;
        });

        return $result;
    }
public static function intersection($array)
    {
        if ($array == null)
            return [];

        $args = func_get_args();
        $argsLength = func_num_args();

        if ($argsLength == 1)
            return $array;

        if (static::every($args, 'is_array'))
            return array_values(call_user_func_array('array_intersect', $args));

        $arrayLenght = static::size($array);
        $result = [];
        static::each($array, function($value, $index) use (& $result, $args, $argsLength) {
            if (static::contains($result, $value))
                return;

            for ($i=1; $i<$argsLength; $i++)
                if (!static::contains($args[$i], $value))
                    break;

            if ($i == $argsLength)
                $result[] = $value;
        });

        return $result;
    }
public static function intersection ( $ array ) { if ( $ array == null ) return [ ] ; $ args = func_get_args ( ) ; $ argsLength = func_num_args ( ) ; if ( $ argsLength == 1 ) return $ array ; if ( static :: every ( $ args , 'is_array' ) ) return array_values ( call_user_func_array ( 'array_intersect' , $ args ) ) ; $ arrayLenght = static :: size ( $ array ) ; $ result = [ ] ; static :: each ( $ array , function ( $ value , $ index ) use ( & $ result , $ args , $ argsLength ) { if ( static :: contains ( $ result , $ value ) ) return ; for ( $ i = 1 ; $ i < $ argsLength ; $ i ++ ) if ( ! static :: contains ( $ args [ $ i ] , $ value ) ) break ; if ( $ i == $ argsLength ) $ result [ ] = $ value ; } ) ; return $ result ; }
Computes the list of values that are the intersection of all the arrays. Each value in the result is present in
each of the arrays.

@category Array Functions

@param traversable $array multiple, the arrays to intersect

@return array
Computes the list of values that are the intersection of all the arrays . Each value in the result is present in each of the arrays .