Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5

 Class JArrayHelper

Description

JArrayHelper is an array utility class for doing all sorts of odds and ends with arrays.

Located in /joomla/utilities/array.php (line 24)

Class JArrayHelper   (Subpackage Utilities)
Method Summary
Static method static array fromObject (object The $p_obj, [boolean $recurse = true], [string $regex = null])
Static method static array getColumn ( &$array, string $index, array $array)
Static method static mixed getValue ( &$array, string $name, [mixed $default = null], [string $type = ''], array $array)
Static method static array sortObjects ( &$a, string $k, [int $direction = 1], array $arr)
Static method static array toInteger ( &$array, [int $default = null], array $array)
Static method static object The toObject ( &$array, [ $toJObject = false], array $array, boolean $jobject)
Static method static int _sortObjects ( &$a,  &$b, array $a, array $b)
Methods
fromObject (line 87)

Utility function to map an object to an array

  • return: The array mapped from the given object
  • since: 1.5
array fromObject (object The $p_obj, [boolean $recurse = true], [string $regex = null])
  • object The $p_obj: source object
  • boolean $recurse: True to recurve through multi-level objects
  • string $regex: An optional regular expression to match on field names
getColumn (line 127)

Extracts a column from an array of arrays or objects

  • return: Column of values from the source array
  • since: 1.5
array getColumn ( &$array, string $index, array $array)
  • array $array: The source array
  • string $index: The index of the column or name of object property
  • &$array
getValue (line 159)

Utility function to return a value from a named array or a specified default

  • return: The value from the source array
  • since: 1.5
mixed getValue ( &$array, string $name, [mixed $default = null], [string $type = ''], array $array)
  • array $array: A named array
  • string $name: The key to search for
  • mixed $default: The default value to give if no key found
  • string $type: Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY)
  • &$array
sortObjects (line 227)

Utility function to sort an array of objects on a given field

  • return: The sorted array of objects
  • since: 1.5
array sortObjects ( &$a, string $k, [int $direction = 1], array $arr)
  • array $arr: An array of objects
  • string $k: The key to sort on
  • int $direction: Direction to sort in [1 = Ascending] [-1 = Descending]
  • &$a
toInteger (line 35)

Function to convert array to integer values

  • since: 1.5
array toInteger ( &$array, [int $default = null], array $array)
  • array $array: The source array to convert
  • int $default: A default value to assign if $array is not an array
  • &$array
toObject (line 59)

Utility function to map an array to a stdClass object.

  • return: object mapped from the given array
  • since: 1.5
object The toObject ( &$array, [ $toJObject = false], array $array, boolean $jobject)
  • array $array: The array to map.
  • boolean $jobject: Optionally create a JObject
  • &$array
  • $toJObject
_sortObjects (line 249)

Private callback function for sorting an array of objects on a key

int _sortObjects ( &$a,  &$b, array $a, array $b)
  • array $a: An array of objects
  • array $b: An array of objects
  • &$a
  • &$b

Documentation generated on Mon, 05 Mar 2007 20:52:23 +0000 by phpDocumentor 1.3.1