Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

fbArray Class Reference

List of all members.

Detailed Description

Array (and hash) related functions.

Definition at line 21 of file Array.php.

Static Public Member Functions

 getNestedKey ($a, $array_of_hash_keys=false)
 getNestedKeyValue ($a, $array_of_hash_keys=false)
 unshiftAssoc (&$arr, $key, $val)
 mergeSort (&$array, $cmp_function= 'strcmp')


Member Function Documentation

fbArray::getNestedKey a,
array_of_hash_keys = false
[static]
 

Get a key from a multi-dimensional array

You have a form with the following input field:

<input type='submit' name='submit[key1][key2][key3]' value='Default Shipping' />

If clicked, this will return the following:

$_REQUEST['submit'] = array('key1' => array('key2' => array('key3' => 'Default Shipping')));

To return the value 'key1', use:

fbArray::getNestedKey($_REQUEST['submit']);

To return the value 'key2', use:

fbArray::getNestedKey($_REQUEST['submit'], 'key1'); or fbArray::getNestedKey($_REQUEST['submit'], array('key1'));

To return the value 'key3', use:

fbArray::getNestedKey($_REQUEST['submit'], array('key1', 'key2'));

To return the value 'Default Shipping', use:

fbArray::getNestedKeyValue($_REQUEST['submit'], array('key1', 'key2', 'key3'));

Parameters:
$a array
$array_of_hash_keys array (optional) array
Returns:
mixed array element if found, otherwise false

Definition at line 56 of file Array.php.

References reset().

fbArray::getNestedKeyValue a,
array_of_hash_keys = false
[static]
 

Get a value from a multi-dimensional array

Parameters:
$a array
$array_of_hash_keys array (optional) array
Returns:
mixed array element if found, otherwise false

Definition at line 106 of file Array.php.

fbArray::mergeSort &$  array,
cmp_function = 'strcmp'
[static]
 

See http://www.php.net/manual/en/function.usort.php#38827

All three of these will work: fbArray::mergeSort($array, 'strcmp'); fbArray::mergeSort($array, array('ClassName', 'StaticFunction')); fbArray::mergeSort($array, array(&$this, 'InstanceFunction'));

Parameters:
$array array reference to array to be sorted
$cmp_function mixed name/array of comparitor function
Returns:
void

Definition at line 167 of file Array.php.

fbArray::unshiftAssoc &$  arr,
key,
val
[static]
 

Add an hash element to the beginning of the hash

See also:
http://us2.php.net/manual/en/function.array-unshift.php#14358
Parameters:
$arr hash
$key mixed Key of array element to insert
$val mixed Value of array element to insert
Returns:
int Count of number of element in array after insertion

Definition at line 147 of file Array.php.


The documentation for this class was generated from the following file:
Generated on Fri Mar 19 12:52:29 2004 for Freebeer by doxygen 1.3.6-20040222