CMXX - Catalog API
This commit is contained in:
@@ -2961,4 +2961,26 @@ function generateLanguageFile($language_key,$token){
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Removekeys from array ++++++++++++++
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
function removeKeysRecursive(array &$array, array $keysToRemove): void {
|
||||
foreach ($array as $key => &$value) {
|
||||
// Remove the key if it exists in our removal list
|
||||
if (in_array($key, $keysToRemove, true)) {
|
||||
unset($array[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If value is an array, recursively process it
|
||||
if (is_array($value)) {
|
||||
removeKeysRecursive($value, $keysToRemove);
|
||||
|
||||
// If array is empty after processing, remove it
|
||||
if (empty($value)) {
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user