public static function filterByKeys($array, array $keysInc = null, array $keysExc = null)
    {
        if ($keysInc !== null) {
            $array = array_intersect_key($array, array_flip($keysInc));
        }
        if ($keysExc) {
            $array = array_diff_key($array, array_flip($keysExc));
        }
        return $array;
    }
public static function filterByKeys($array, array $keysInc = null, array $keysExc = null)
    {
        if ($keysInc !== null) {
            $array = array_intersect_key($array, array_flip($keysInc));
        }
        if ($keysExc) {
            $array = array_diff_key($array, array_flip($keysExc));
        }
        return $array;
    }
public static function filterByKeys ( $ array , array $ keysInc = null , array $ keysExc = null ) { if ( $ keysInc !== null ) { $ array = array_intersect_key ( $ array , array_flip ( $ keysInc ) ) ; } if ( $ keysExc ) { $ array = array_diff_key ( $ array , array_flip ( $ keysExc ) ) ; } return $ array ; }
Filters items by given keys.

@param array $array   source assoc array
@param array $keysInc keys of items, that should be included
@param array $keysExc keys of items, that should be excluded
@return array|mixed|null    filtered array
Filters items by given keys .