[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/ -> Array.php (sommaire)

(pas de description)

Poids: 240 lignes (8 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Horde_Array:: (8 méthodes):
  prepareAddressList()
  sortAddressList()
  arraySort()
  getArrayParts()
  getElement()
  getRectangle()
  valuesToKeys()
  combine()


Classe: Horde_Array  - X-Ref

The Horde_Array:: class provides various methods for array manipulation.

$Horde: framework/Util/Array.php,v 1.26.2.8 2006/01/01 21:28:41 jan Exp $

Copyright 2003-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>
Copyright 2003-2006 Marko Djukic <marko@oblo.com>
Copyright 2003-2006 Jan Schneider <jan@horde.org>

See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

prepareAddressList($addr)   X-Ref
Prepare a list of addresses for storage.
Namely, trims and lowercases all addresses and then sort.

param: array $addr  The list of addresses.
return: array  The list of addresses, prepared for storage.

sortAddressList($a, $b)   X-Ref
Function used by usort() to sort an address list.
e.g. usort($foo, array('Horde_Array', 'sortAddressList'));

param: string $a  Address #1.
param: string $b  Address #2.
return: integer  -1, 0, or 1.

arraySort(&$array, $key = null, $direction = 0, $associate = true)   X-Ref
Sorts an array on a specified key. If the key does not exist,
defaults to the first key of the array.

param: array &$array       The array to be sorted, passed by reference.
param: string $key         The key by which to sort. If not specified
param: integer $direction  Sort direction
param: boolean $associate  Keep key value association?

getArrayParts($field, &$base, &$keys)   X-Ref
Given an HTML type array field "example[key1][key2][key3]" breaks up
the keys so that they could be used to reference a regular PHP array.

param: string $field  The field name to be examined.
param: string &$base  Set to the base element.
param: array &$keys   Set to the list of keys.
return: boolean  True on sucess, false on error.

getElement(&$array, &$keys, $value = null)   X-Ref
Using an array of keys itarate through the array following the
keys to find the final key value. If a value is passed then set
that value.

param: array &$array  The array to be used.
param: array &$keys   The key path to follow as an array.
param: array $value   If set the target element will have this value set
return: mixed  The final value of the key path.

getRectangle(&$array, $row, $col, $height, $width)   X-Ref
Returns a rectangle of a two-dimensional array.

param: array &$array    The array to extract the rectangle from.
param: integer $row     The start row of the rectangle.
param: integer $col     The start column of the rectangle.
param: integer $height  The height of the rectangle.
param: integer $width   The width of the rectangle.
return: array  The extracted rectangle.

valuesToKeys($array)   X-Ref
Given an array, returns an associative array with each element key
derived from its value.
For example:
array(0 => 'foo', 1 => 'bar')
would become:
array('foo' => 'foo', 'bar' => 'bar')

param: array $array  An array of values.
return: array  An array with keys the same as values.

combine($keys, $values)   X-Ref
Creates an array by using one array for keys and another for
its values. Only exists in PHP5, so we call array_combine if it
exists and otherwise emulate it.

param: array $keys    Key array.
param: array $values  Value array.
return: mixed  False if there are no elements, or the combined array.



Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7