JArrayHelper
class JArrayHelper
JArrayHelper is an array utility class for doing all sorts of odds and ends with arrays.
Methods
Function to convert array to integer values
Utility function to map an array to a stdClass object.
Utility function to map an array to a string.
Utility function to map an object to an array
Extracts a column from an array of arrays or objects
Utility function to return a value from a named array or a specified default
Takes an associative array of arrays and inverts the array keys to values using the array values as keys.
Method to determine if an array is an associative array.
Pivots an array to create a reverse lookup of an array of scalars, arrays or objects.
Utility function to sort an array of objects on a given field
Multidimensional array safe unique test
Details
static
void
toInteger(
array $array,
mixed $default = null)
Function to convert array to integer values
static
object
toObject(
array $array,
string $class = 'stdClass',
boolean $recursive = true)
Utility function to map an array to a stdClass object.
static
string
toString(
array $array = null,
string $inner_glue = '=',
string $outer_glue = ' ',
boolean $keepOuterKey = false)
Utility function to map an array to a string.
static
array
fromObject(
object $p_obj,
boolean $recurse = true,
string $regex = null)
Utility function to map an object to an array
static
array
getColumn(
array $array,
string $index)
Extracts a column from an array of arrays or objects
static
mixed
getValue(
array $array,
string $name,
mixed $default = null,
string $type = '')
Utility function to return a value from a named array or a specified default
static
array
invert(
array $array)
Takes an associative array of arrays and inverts the array keys to values using the array values as keys.
Example: $input = array( 'New' => array('1000', '1500', '1750'), 'Used' => array('3000', '4000', '5000', '6000') ); $output = JArrayHelper::invert($input);
Output would be equal to: $output = array( '1000' => 'New', '1500' => 'New', '1750' => 'New', '3000' => 'Used', '4000' => 'Used', '5000' => 'Used', '6000' => 'Used' );
static
boolean
isAssociative(
array $array)
Method to determine if an array is an associative array.
static
array
pivot(
array $source,
string $key = null)
Pivots an array to create a reverse lookup of an array of scalars, arrays or objects.