diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-07-04 14:42:29 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2012-07-04 14:42:29 +0200 |
commit | bf0e38be236812656890223eea3b9f0dc68582c0 (patch) | |
tree | 6022c2117462ce294025a863a191d4546907d5a1 | |
parent | 4d1a214836fc16bbecd5afd11060a56bc2859b7d (diff) |
Further update to `element()` to remove more unexpected results.
-rw-r--r-- | system/helpers/array_helper.php | 4 |
1 files changed, 2 insertions, 2 deletions
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; |