1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
\r
5 * An open source application development framework for PHP 4.3.2 or newer
\r
7 * @package CodeIgniter
\r
8 * @author ExpressionEngine Dev Team
\r
9 * @copyright Copyright (c) 2008, EllisLab, Inc.
\r
10 * @license http://codeigniter.com/user_guide/license.html
\r
11 * @link http://codeigniter.com
\r
12 * @since Version 1.0
\r
16 // ------------------------------------------------------------------------
\r
19 * CodeIgniter Array Helpers
\r
21 * @package CodeIgniter
\r
22 * @subpackage Helpers
\r
24 * @author ExpressionEngine Dev Team
\r
25 * @link http://codeigniter.com/user_guide/helpers/array_helper.html
\r
28 // ------------------------------------------------------------------------
\r
33 * Lets you determine whether an array index is set and whether it has a value.
\r
34 * If the element is empty it returns FALSE (or whatever you specify as the default value.)
\r
40 * @return mixed depends on what the array contains
\r
42 if ( ! function_exists('element'))
\r
44 function element($item, $array, $default = FALSE)
\r
46 if ( ! isset($array[$item]) OR $array[$item] == "")
\r
51 return $array[$item];
\r
55 // ------------------------------------------------------------------------
\r
58 * Random Element - Takes an array as input and returns a random element
\r
62 * @return mixed depends on what the array contains
\r
64 if ( ! function_exists('random_element'))
\r
66 function random_element($array)
\r
68 if ( ! is_array($array))
\r
72 return $array[array_rand($array)];
\r
77 /* End of file array_helper.php */
\r
78 /* Location: ./system/helpers/array_helper.php */