modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-06-28 10:31:34 +04:00
parent 0887f53dc4
commit ba8a51dae8
1 changed files with 13 additions and 0 deletions

View File

@ -557,6 +557,19 @@ class cl {
return $mapped;
}
/**
* indiquer si {@link self::rekey()} modifierai le tableau indiqué (s'il y a
* des modifications à faire)
*/
static function would_rekey(?array $array, ?array $mappings, bool $inverse=false): bool {
if ($array === null || $mappings === null) return false;
if ($inverse) $mappings = array_flip($mappings);
foreach ($array as $key => $value) {
if (array_key_exists($key, $mappings)) return true;
}
return false;
}
#############################################################################
/** tester si tous les éléments du tableau satisfont la condition */