summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlakoff <vlakoff@gmail.com>2012-07-02 15:20:42 +0200
committervlakoff <vlakoff@gmail.com>2012-07-02 15:20:42 +0200
commit0cd553566578dd4c23e1541fc837901bdfefa831 (patch)
tree1e0822a5e193eccb01acca6a5ead41cbc881d17b
parentfac3761c6a01a12457c61cd4e3b17dba5ee26bf7 (diff)
Update Array Helper documentation
default value of the "default value" parameter has changed in element() and elements() methods
-rw-r--r--system/helpers/array_helper.php2
-rw-r--r--user_guide_src/source/helpers/array_helper.rst34
2 files changed, 18 insertions, 18 deletions
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 216f12e56..5d0243951 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -43,7 +43,7 @@ if ( ! function_exists('element'))
* Element
*
* 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.)
+ * If the element is empty it returns NULL (or whatever you specify as the default value.)
*
* @param string
* @param array
diff --git a/user_guide_src/source/helpers/array_helper.rst b/user_guide_src/source/helpers/array_helper.rst
index 4308753bb..15b5e17c4 100644
--- a/user_guide_src/source/helpers/array_helper.rst
+++ b/user_guide_src/source/helpers/array_helper.rst
@@ -21,17 +21,17 @@ The following functions are available:
element()
=========
-.. php:method:: element($item, $array, $default = FALSE)
+.. php:method:: element($item, $array, $default = NULL)
:param string $item: Item to fetch from the array
:param array $array: Input array
:param boolean $default: What to return if the array isn't valid
- :returns: FALSE on failure or the array item.
+ :returns: NULL on failure or the array item.
Lets you fetch an item from an array. The function tests whether the
array index is set and whether it has a value. If a value exists it is
-returned. If a value does not exist it returns FALSE, or whatever you've
+returned. If a value does not exist it returns NULL, or whatever you've
specified as the default value via the third parameter. Example
::
@@ -43,31 +43,31 @@ specified as the default value via the third parameter. Example
);
echo element('color', $array); // returns "red"
- echo element('size', $array, NULL); // returns NULL
+ echo element('size', $array, 'foobar'); // returns "foobar"
elements()
==========
Lets you fetch a number of items from an array. The function tests
whether each of the array indices is set. If an index does not exist it
-is set to FALSE, or whatever you've specified as the default value via
+is set to NULL, or whatever you've specified as the default value via
the third parameter.
-.. php:method:: elements($items, $array, $default = FALSE)
+.. php:method:: elements($items, $array, $default = NULL)
:param string $item: Item to fetch from the array
:param array $array: Input array
:param boolean $default: What to return if the array isn't valid
- :returns: FALSE on failure or the array item.
+ :returns: NULL on failure or the array item.
Example
::
$array = array(
- 'color' => 'red',  
- 'shape' => 'round',     
- 'radius' => '10',     
+ 'color' => 'red',
+ 'shape' => 'round',
+ 'radius' => '10',
'diameter' => '20'
);
@@ -78,25 +78,25 @@ The above will return the following array
::
array(
- 'color' => 'red',     
- 'shape' => 'round',     
- 'height' => FALSE
+ 'color' => 'red',
+ 'shape' => 'round',
+ 'height' => NULL
);
You can set the third parameter to any default value you like
::
- $my_shape = elements(array('color', 'shape', 'height'), $array, NULL);
+ $my_shape = elements(array('color', 'shape', 'height'), $array, 'foobar');
The above will return the following array
::
array(     
- 'color' => 'red',     
- 'shape' => 'round',     
- 'height' => NULL
+ 'color' => 'red',
+ 'shape' => 'round',
+ 'height' => 'foobar'
);
This is useful when sending the $_POST array to one of your Models.