/** * Opposite of filter where properties match - rejects any items where properties do match * @param array $collection A collection of arrays. Any values that are not arrays will be automatically filtered * out. * @param array $property_list An array of properties that must NOT match for the item to be included in the final * list. Comparison is run using ArrayUtility::dotRead * @param string $match_type Any of the available MATCH_TYPE_* constants. Affects whether value comparisons are * performed on exact data types. * @param bool $force_key_preservation Keys are preserved for assoc arrays only by default. Set to true to ALWAYS * preserve keys * @return array */ public static function filterWhereNot(array $collection, array $property_list, $match_type = self::MATCH_TYPE_LOOSE, $force_key_preservation = false) { $preserve_keys = $force_key_preservation || ArrayUtility::isAssoc($collection); $filtered = array_diff_key($collection, self::filterWhere($collection, $property_list, $match_type, true)); return $preserve_keys ? $filtered : array_values($filtered); }