From ba8a51dae84c0082521affa4246f2b1cb52852f2 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 28 Jun 2024 10:31:34 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- src/cl.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cl.php b/src/cl.php index fe4ef52..c17f2db 100644 --- a/src/cl.php +++ b/src/cl.php @@ -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 */