From edf68d9921b0bda89106f3e7c2b61336d1fca28f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 12 Jul 2020 12:15:59 +0700 Subject: [PATCH] optimize Session : use foreach instead of for with count when possible --- system/Session/Session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Session/Session.php b/system/Session/Session.php index 8e845462065b..4c6f39ec9c0e 100644 --- a/system/Session/Session.php +++ b/system/Session/Session.php @@ -723,9 +723,9 @@ public function markAsFlashdata($key): bool { if (is_array($key)) { - for ($i = 0, $c = count($key); $i < $c; $i ++) + foreach ($key as $sessionKey) { - if (! isset($_SESSION[$key[$i]])) + if (! isset($_SESSION[$sessionKey])) { return false; }