summaryrefslogtreecommitdiffstats
path: root/system/helpers/array_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/array_helper.php')
-rw-r--r--system/helpers/array_helper.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 85d03794c..236e3904e 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -39,14 +39,17 @@
* @param mixed
* @return mixed depends on what the array contains
*/
-function element($item, $array, $default = FALSE)
+if (! function_exists('element'))
{
- if ( ! isset($array[$item]) OR $array[$item] == "")
+ function element($item, $array, $default = FALSE)
{
- return $default;
- }
+ if ( ! isset($array[$item]) OR $array[$item] == "")
+ {
+ return $default;
+ }
- return $array[$item];
+ return $array[$item];
+ }
}
// ------------------------------------------------------------------------
@@ -58,14 +61,16 @@ function element($item, $array, $default = FALSE)
* @param array
* @return mixed depends on what the array contains
*/
-function random_element($array)
+if (! function_exists('random_element'))
{
- if ( ! is_array($array))
+ function random_element($array)
{
- return $array;
- }
- return $array[array_rand($array)];
+ if ( ! is_array($array))
+ {
+ return $array;
+ }
+ return $array[array_rand($array)];
+ }
}
-
?> \ No newline at end of file