diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-13 11:23:37 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-13 11:23:37 +0100 |
commit | 868163330c6e6eb7af04ee3b2510b594608d34ad (patch) | |
tree | 22cd130b389912376f00a3bd3128f56224d4687e | |
parent | 60138567c58dd924e2240973e34f0e3903a7ef2b (diff) | |
parent | e5617335b5130718c43e5072ad003f677619d332 (diff) |
Merge upstream branch
-rw-r--r-- | system/helpers/array_helper.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index fad22341d..464d1d112 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -43,7 +43,6 @@ * Lets you determine whether an array index is set and whether it has a value. * If the element is empty it returns FALSE (or whatever you specify as the default value.) * - * @access public * @param string * @param array * @param mixed @@ -53,7 +52,7 @@ if ( ! function_exists('element')) { function element($item, $array, $default = FALSE) { - return ( ! isset($array[$item]) OR $array[$item] == '') ? $default : $array[$item]; + return empty($array[$item]) ? $default : $array[$item]; } } @@ -62,7 +61,6 @@ if ( ! function_exists('element')) /** * Random Element - Takes an array as input and returns a random element * - * @access public * @param array * @return mixed depends on what the array contains */ @@ -79,10 +77,9 @@ if ( ! function_exists('random_element')) /** * Elements * - * Returns only the array items specified. Will return a default value if + * Returns only the array items specified. Will return a default value if * it is not set. * - * @access public * @param array * @param array * @param mixed @@ -93,10 +90,8 @@ if ( ! function_exists('elements')) function elements($items, $array, $default = FALSE) { $return = array(); - if ( ! is_array($items)) - { - $items = array($items); - } + + is_array($items) OR $items = array($items); foreach ($items as $item) { |