From bf0e38be236812656890223eea3b9f0dc68582c0 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 4 Jul 2012 14:42:29 +0200 Subject: Further update to `element()` to remove more unexpected results. --- system/helpers/array_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/array_helper.php') diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index 0dfc3e1ae..5a7f633e8 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -52,7 +52,7 @@ if ( ! function_exists('element')) */ function element($item, $array, $default = NULL) { - return ! isset($array[$item]) ? $default : $array[$item]; + return array_key_exists($array[$item]) ? $array[$item] : $default; } } @@ -95,7 +95,7 @@ if ( ! function_exists('elements')) foreach ($items as $item) { - $return[$item] = isset($array[$item]) ? $array[$item] : $default; + $return[$item] = array_key_exists($array[$item]) ? $array[$item] : $default; } return $return; -- cgit v1.2.3-24-g4f1b