From 61e489ee4cb7a897c853e29c9bea7955aca04740 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Thu, 17 Oct 2024 09:44:24 +0900 Subject: [PATCH] Remove entries from an array wrapper just wrapper around array_diff --- www/lib/CoreLibs/Combined/ArrayHandler.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/www/lib/CoreLibs/Combined/ArrayHandler.php b/www/lib/CoreLibs/Combined/ArrayHandler.php index bbe3943f..b1002949 100644 --- a/www/lib/CoreLibs/Combined/ArrayHandler.php +++ b/www/lib/CoreLibs/Combined/ArrayHandler.php @@ -509,6 +509,22 @@ class ArrayHandler } return $array; } + + /** + * Remove entries from a simple array, will not keep key order + * + * any array content is allowed + * + * https://stackoverflow.com/a/369608 + * + * @param array $array Array where elements are located + * @param array $remove Elements to remove + * @return array Array with $remove elements removed + */ + public static function arrayRemoveEntry(array $array, array $remove): array + { + return array_diff($array, $remove); + } } // __END__