From a8777ae113732dd18f9cf04d825322f596fedac7 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 13 Feb 2017 14:57:35 +0100 Subject: [PATCH] Don't use each(). For modern PHP versions there is no improved performance or memory usage compared to foreach() anymore. Beside that it's deprecated in PHP 7.2. --- lib/Horde/String.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Horde/String.php b/lib/Horde/String.php index 26dfcbc..aa8f990 100644 --- a/lib/Horde/String.php +++ b/lib/Horde/String.php @@ -66,8 +66,7 @@ public static function convertCharset($input, $from, $to, $force = false) if (is_array($input)) { $tmp = array(); - reset($input); - while (list($key, $val) = each($input)) { + foreach ($input as $key => $val) { $tmp[self::_convertCharset($key, $from, $to)] = self::convertCharset($val, $from, $to, $force); } return $tmp; @@ -84,7 +83,7 @@ public static function convertCharset($input, $from, $to, $force = false) $input = clone $input; $vars = get_object_vars($input); - while (list($key, $val) = each($vars)) { + foreach ($vars as $key => $val) { $input->$key = self::convertCharset($val, $from, $to, $force); } return $input;