com.caucho.quercus.lib
Class ArrayModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.ArrayModule
All Implemented Interfaces:
QuercusModule

public class ArrayModule
extends AbstractQuercusModule

PHP array routines.


Field Summary
static boolean CASE_INSENSITIVE
           
static int CASE_LOWER
           
static boolean CASE_SENSITIVE
           
static int CASE_UPPER
           
static int COUNT_NORMAL
           
static int COUNT_RECURSIVE
           
static int EXTR_IF_EXISTS
           
static int EXTR_OVERWRITE
           
static int EXTR_PREFIX_ALL
           
static int EXTR_PREFIX_IF_EXISTS
           
static int EXTR_PREFIX_INVALID
           
static int EXTR_PREFIX_SAME
           
static int EXTR_REFS
           
static int EXTR_SKIP
           
static boolean KEY_RESET
           
static boolean NO_KEY_RESET
           
static boolean NOT_STRICT
           
static int SORT_ASC
           
static int SORT_DESC
           
static int SORT_LOCALE_STRING
           
static int SORT_NORMAL
           
static int SORT_NUMERIC
           
static int SORT_REGULAR
           
static int SORT_REVERSE
           
static int SORT_STRING
           
static boolean STRICT
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
ArrayModule()
           
 
Method Summary
static Value array_change_key_case(Env env, ArrayValue array, int toCase)
          Changes the key case
static Value array_chunk(Env env, ArrayValue array, int size, boolean preserveKeys)
          Chunks the array
static Value array_combine(Env env, ArrayValue keys, ArrayValue values)
          Combines array
static Value array_count_values(Env env, ArrayValue array)
          Counts the values
static Value array_diff_assoc(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and not in the other arrays, keys also used
static Value array_diff_key(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and not in the other arrays, keys used for comparison
static Value array_diff_uassoc(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and not in the other arrays, keys used for comparison aswell
static Value array_diff_ukey(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and not in the other arrays, keys used for comparison only
static Value array_diff(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and not in the other arrays using a passed callback function for comparing
static ArrayValue array_fill_keys(Env env, ArrayValue keyArray, Value value)
           
static Value array_fill(Env env, long start, long num, Value value)
          Returns an array with a number of indices filled with the given value, starting at the start index.
static Value array_filter(Env env, ArrayValue array, Value callbackName)
          Returns an array that filters out any values that do not hold true when used in the callback function.
static Value array_flip(Env env, ArrayValue array)
          Returns an array with the given array's keys as values and its values as keys.
static Value array_intersect_assoc(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and also in the other arrays, keys are also used in the comparison
static Value array_intersect_key(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and also in the other arrays, keys are only used in the comparison
static Value array_intersect_uassoc(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and also in the other arrays, keys are also used in the comparison.
static Value array_intersect_ukey(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and also in the other arrays, keys are only used in the comparison.
static Value array_intersect(Env env, ArrayValue array, Value[] arrays)
          Returns an array with everything that is in array and also in the other arrays
static boolean array_key_exists(Env env, Value key, Value searchArray)
          Checks if the key is in the given array
static Value array_keys(Env env, ArrayValue array, Value searchValue, boolean isStrict)
          Returns an array of the keys in the given array
static Value array_map(Env env, Callable fun, ArrayValue arg, Value[] args)
          Maps the given function with the array arguments.
static Value array_merge_recursive(Env env, Value[] args)
          Maps the given function with the array arguments.
static Value array_merge(Env env, Value[] args)
          Maps the given function with the array arguments.
static boolean array_multisort(Env env, Value[] arrays)
          Sort the arrays like rows in a database.
static Value array_pad(Env env, ArrayValue input, long padSize, Value padValue)
          Returns an array with either the front/end padded with the pad value.
static Value array_pop(Env env, Value array)
          Pops off the top element
static Value array_product(Env env, ArrayValue array)
          Returns the product of the input array's elements as a double.
static int array_push(Env env, Value array, Value[] values)
          Appends a value to the array
static Value array_rand(Env env, ArrayValue array, long num)
          Returns num sized array of random keys from the given array
static Value array_reduce(Env env, ArrayValue array, Callable callable, Value initialValue)
          Returns the value of the array when its elements have been reduced using the callback function.
static Value array_replace_recursive(Env env, Value[] args)
          Replace elements in the first array with values from successive ones
static Value array_replace(Env env, Value[] args)
          Replace elements in the first array with values from successive ones
static Value array_reverse(Env env, ArrayValue inputArray, boolean keyed)
          Returns the inputted array reversed, preserving the keys if keyed is true
static Value array_search(Env env, Value needle, ArrayValue array, boolean strict)
          Returns the key of the needle being searched for or false if it's not found
static Value array_shift(Env env, Value value)
          Shifts the elements in the array left by one, returning the leftmost value
static Value array_slice(Env env, ArrayValue array, int offset, Value length, boolean isPreserveKeys)
          Returns a chunk of the array.
static Value array_splice(Env env, Value arrayVar, int offset, Value length, Value replace)
          Returns the removed chunk of the arrayV and splices in replace.
static Value array_sum(Env env, ArrayValue array)
          Returns the sum of the elements in the array
static Value array_udiff_assoc(Env env, Value[] arrays)
          Creates an array with all the values of the first array that are not present in the other arrays, using a provided callback function to determine equivalence.
static Value array_udiff_uassoc(Env env, Value[] arrays)
          Creates an array with all the values of the first array that are not present in the other arrays, using a provided callback function to determine equivalence.
static Value array_udiff(Env env, Value[] arrays)
          Creates an array with all the values of the first array that are not present in the other arrays, using a provided callback function to determine equivalence.
static Value array_uintersect_assoc(Env env, Value[] arrays)
          Creates an array with all the values of the first array that are present in the other arrays, using a provided callback function to determine equivalence.
static Value array_uintersect_uassoc(Env env, Value[] arrays)
          Creates an array with all the values of the first array that are present in the other arrays, using a provided callback function to determine equivalence.
static Value array_uintersect(Env env, Value[] arrays)
          Creates an array with all the values of the first array that are present in the other arrays, using a provided callback function to determine equivalence.
static Value array_unique(Env env, ArrayValue array)
          Returns the inputted array without duplicates
static Value array_unshift(Env env, Value value, Value[] values)
          Prepends the elements to the array
static Value array_values(Env env, ArrayValue array)
          Returns the values in the passed array with numerical indices.
static boolean array_walk_recursive(Env env, Value arrayVar, Callable callback, Value extra)
          Recursively executes a callback function on all elements in the array, including elements of elements (i.e., arrays within arrays).
static boolean array_walk(Env env, Value arrayVar, Callable callback, Value userData)
          Executes a callback on each of the elements in the array.
static boolean arsort(Env env, Value arrayVar, long sortFlag)
          Sorts the array based on values in reverse order, preserving keys
static boolean asort(Env env, Value arrayVar, long sortFlag)
          Sorts the array based on values in ascending order, preserving keys
static ArrayValue compact(Env env, Value[] variables)
          Creates an array of corresponding values to variables in the symbol name.
static long count(Env env, Value value, int countMethod)
          Returns the size of the array.
static Value current(Value value)
          Returns the current value of the array.
static Value each(Env env, Value value)
          Returns the next value of the array.
static Value end(Value value)
          Resets the pointer to the end
static Value extract(Env env, ArrayValue array)
          Inputs new variables into the symbol table from the passed array
static Value extract(Env env, ArrayValue array, long rawType, Value valuePrefix)
          Inputs new variables into the symbol table from the passed array
 java.lang.String[] getLoadedExtensions()
          Returns the extensions loaded by the module.
static boolean in_array(Value needle, ArrayValue stack, boolean strict)
          Determines if the key is in the array
static boolean key_exists(Env env, Value key, Value searchArray)
          Undocumented alias for array_key_exists(com.caucho.quercus.env.Env, com.caucho.quercus.env.Value, com.caucho.quercus.env.Value).
static Value key(Value value)
          Returns the current key of the array.
static boolean krsort(Env env, Value arrayVar, long sortFlag)
          Sorts the array based on keys in reverse order, preserving keys
static boolean ksort(Env env, Value arrayVar, long sortFlag)
          Sorts the array based on keys in ascending order, preserving keys
static Value natcasesort(Env env, Value arrayVar)
          Sorts the array based on string values using natural order, preserving keys, case insensitive
static Value natsort(Env env, Value arrayVar)
          Sorts the array based on string values using natural order, preserving keys, case sensitive
static Value next(Value value)
          Returns the next value of the array.
static Value pos(Value value)
          Returns the current value of the array.
static Value prev(Value array)
          Returns the previous value of the array.
static Value range(Env env, Value start, Value end, long step)
          Creates an array using the start and end values provided
static Value reset(Value array)
          Resets the pointer
static boolean rsort(Env env, Value arrayVar, long sortFlag)
          Sorts the array based on values in reverse order
static Value shuffle(Env env, Value array)
          Returns the current value of the array.
static long sizeof(Env env, Value value, int countMethod)
          Returns the size of the array.
static boolean sort(Env env, Value arrayVar, long sortFlag)
          Sorts the array based on values in ascending order
static Value spliceImpl(Env env, Value var, ArrayValue array, int start, int end, ArrayValue replace)
           
static boolean uasort(Env env, Value arrayVar, Callable func, long sortFlag)
          Sorts the array based on values in ascending order using a callback function
static boolean uksort(Env env, Value arrayVar, Callable func, long sortFlag)
          Sorts the array based on values in ascending order using a callback function
static boolean usort(Env env, Value arrayVar, Callable func, long sortFlag)
          Sorts the array based on values in ascending order using a callback function
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CASE_UPPER

public static final int CASE_UPPER
See Also:
Constant Field Values

CASE_LOWER

public static final int CASE_LOWER
See Also:
Constant Field Values

SORT_REGULAR

public static final int SORT_REGULAR
See Also:
Constant Field Values

SORT_NUMERIC

public static final int SORT_NUMERIC
See Also:
Constant Field Values

SORT_STRING

public static final int SORT_STRING
See Also:
Constant Field Values

SORT_LOCALE_STRING

public static final int SORT_LOCALE_STRING
See Also:
Constant Field Values

SORT_NORMAL

public static final int SORT_NORMAL
See Also:
Constant Field Values

SORT_REVERSE

public static final int SORT_REVERSE
See Also:
Constant Field Values

SORT_DESC

public static final int SORT_DESC
See Also:
Constant Field Values

SORT_ASC

public static final int SORT_ASC
See Also:
Constant Field Values

EXTR_OVERWRITE

public static final int EXTR_OVERWRITE
See Also:
Constant Field Values

EXTR_SKIP

public static final int EXTR_SKIP
See Also:
Constant Field Values

EXTR_PREFIX_SAME

public static final int EXTR_PREFIX_SAME
See Also:
Constant Field Values

EXTR_PREFIX_ALL

public static final int EXTR_PREFIX_ALL
See Also:
Constant Field Values

EXTR_PREFIX_INVALID

public static final int EXTR_PREFIX_INVALID
See Also:
Constant Field Values

EXTR_IF_EXISTS

public static final int EXTR_IF_EXISTS
See Also:
Constant Field Values

EXTR_PREFIX_IF_EXISTS

public static final int EXTR_PREFIX_IF_EXISTS
See Also:
Constant Field Values

EXTR_REFS

public static final int EXTR_REFS
See Also:
Constant Field Values

COUNT_NORMAL

public static final int COUNT_NORMAL
See Also:
Constant Field Values

COUNT_RECURSIVE

public static final int COUNT_RECURSIVE
See Also:
Constant Field Values

CASE_SENSITIVE

public static final boolean CASE_SENSITIVE
See Also:
Constant Field Values

CASE_INSENSITIVE

public static final boolean CASE_INSENSITIVE
See Also:
Constant Field Values

KEY_RESET

public static final boolean KEY_RESET
See Also:
Constant Field Values

NO_KEY_RESET

public static final boolean NO_KEY_RESET
See Also:
Constant Field Values

STRICT

public static final boolean STRICT
See Also:
Constant Field Values

NOT_STRICT

public static final boolean NOT_STRICT
See Also:
Constant Field Values
Constructor Detail

ArrayModule

public ArrayModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Description copied from class: AbstractQuercusModule
Returns the extensions loaded by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

array_change_key_case

public static Value array_change_key_case(Env env,
                                          ArrayValue array,
                                          int toCase)
Changes the key case


array_chunk

public static Value array_chunk(Env env,
                                ArrayValue array,
                                int size,
                                boolean preserveKeys)
Chunks the array


array_combine

public static Value array_combine(Env env,
                                  ArrayValue keys,
                                  ArrayValue values)
Combines array


array_count_values

public static Value array_count_values(Env env,
                                       ArrayValue array)
Counts the values


array_diff_assoc

public static Value array_diff_assoc(Env env,
                                     ArrayValue array,
                                     Value[] arrays)
Returns an array with everything that is in array and not in the other arrays, keys also used

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against
Returns:
an array with all of the values that are in the primary array but not in the other arrays

array_diff_key

public static Value array_diff_key(Env env,
                                   ArrayValue array,
                                   Value[] arrays)
Returns an array with everything that is in array and not in the other arrays, keys used for comparison

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against
Returns:
an array with all of the values that are in the primary array but not in the other arrays

array_diff_uassoc

public static Value array_diff_uassoc(Env env,
                                      ArrayValue array,
                                      Value[] arrays)
Returns an array with everything that is in array and not in the other arrays, keys used for comparison aswell

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array but not in the other arrays

array_diff_ukey

public static Value array_diff_ukey(Env env,
                                    ArrayValue array,
                                    Value[] arrays)
Returns an array with everything that is in array and not in the other arrays, keys used for comparison only

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array but not in the other arrays

array_diff

public static Value array_diff(Env env,
                               ArrayValue array,
                               Value[] arrays)
Returns an array with everything that is in array and not in the other arrays using a passed callback function for comparing

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against
Returns:
an array with all of the values that are in the primary array but not in the other arrays

array_fill_keys

public static ArrayValue array_fill_keys(Env env,
                                         ArrayValue keyArray,
                                         Value value)

array_fill

public static Value array_fill(Env env,
                               long start,
                               long num,
                               Value value)
Returns an array with a number of indices filled with the given value, starting at the start index.

Parameters:
start - the index to start filling the array
num - the number of entries to fill
value - the value to fill the entries with
Returns:
an array filled with the given value starting from the given start index

array_filter

public static Value array_filter(Env env,
                                 ArrayValue array,
                                 Value callbackName)
Returns an array that filters out any values that do not hold true when used in the callback function.

Parameters:
array - the array to filter
callback - the function name for filtering
Returns:
a filtered array

array_flip

public static Value array_flip(Env env,
                               ArrayValue array)
Returns an array with the given array's keys as values and its values as keys. If the given array has matching values, the latest value will be transfered and the others will be lost.

Parameters:
array - the array to flip
Returns:
an array with it's keys and values swapped

array_intersect_assoc

public static Value array_intersect_assoc(Env env,
                                          ArrayValue array,
                                          Value[] arrays)
Returns an array with everything that is in array and also in the other arrays, keys are also used in the comparison

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array and in the other arrays

array_intersect_key

public static Value array_intersect_key(Env env,
                                        ArrayValue array,
                                        Value[] arrays)
Returns an array with everything that is in array and also in the other arrays, keys are only used in the comparison

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array and in the other arrays

array_intersect_uassoc

public static Value array_intersect_uassoc(Env env,
                                           ArrayValue array,
                                           Value[] arrays)
Returns an array with everything that is in array and also in the other arrays, keys are also used in the comparison. Uses a callback function for evalutation the keys.

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array and in the other arrays

array_intersect_ukey

public static Value array_intersect_ukey(Env env,
                                         ArrayValue array,
                                         Value[] arrays)
Returns an array with everything that is in array and also in the other arrays, keys are only used in the comparison. Uses a callback function for evalutation the keys.

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array and in the other arrays

array_intersect

public static Value array_intersect(Env env,
                                    ArrayValue array,
                                    Value[] arrays)
Returns an array with everything that is in array and also in the other arrays

Parameters:
array - the primary array
arrays - the vector of arrays to check the primary array's values against. The last element is the callback function.
Returns:
an array with all of the values that are in the primary array and in the other arrays

array_key_exists

public static boolean array_key_exists(Env env,
                                       Value key,
                                       Value searchArray)
Checks if the key is in the given array

Parameters:
key - a key to check for in the array
searchArray - the array to search for the key in
Returns:
true if the key is in the array, and false otherwise

array_keys

public static Value array_keys(Env env,
                               ArrayValue array,
                               Value searchValue,
                               boolean isStrict)
Returns an array of the keys in the given array

Parameters:
array - the array to obtain the keys for
searchValue - the corresponding value of the returned key array
Returns:
an array containing the keys

array_map

public static Value array_map(Env env,
                              Callable fun,
                              ArrayValue arg,
                              Value[] args)
Maps the given function with the array arguments.

Parameters:
fun - the function name
args - the vector of array arguments
Returns:
an array with all of the mapped values

array_merge_recursive

public static Value array_merge_recursive(Env env,
                                          Value[] args)
Maps the given function with the array arguments.

Parameters:
args - the vector of array arguments
Returns:
an array with all of the mapped values

array_merge

public static Value array_merge(Env env,
                                Value[] args)
Maps the given function with the array arguments.

Parameters:
args - the vector of array arguments
Returns:
an array with all of the mapped values

array_multisort

public static boolean array_multisort(Env env,
                                      Value[] arrays)
Sort the arrays like rows in a database.

Parameters:
arrays - arrays to sort
Returns:
true on success, and false on failure

array_pad

public static Value array_pad(Env env,
                              ArrayValue input,
                              long padSize,
                              Value padValue)
Returns an array with either the front/end padded with the pad value. If the pad size is positive, the padding is performed on the end. If negative, then the array is padded on the front. The pad size is the new array size. If this size is not greater than the current array size, then the original input array is returned.

Parameters:
input - the array to pad
padSize - the amount to pad the array by
padValue - determines front/back padding and the value to place in the padded space
Returns:
a padded array

array_pop

public static Value array_pop(Env env,
                              Value array)
Pops off the top element


array_product

public static Value array_product(Env env,
                                  ArrayValue array)
Returns the product of the input array's elements as a double.

Parameters:
array - the array for who's product is to be found
Returns:
the produce of the array's elements

array_push

public static int array_push(Env env,
                             Value array,
                             Value[] values)
Appends a value to the array

Returns:
the number of elements in the final array

array_rand

public static Value array_rand(Env env,
                               ArrayValue array,
                               long num)
Returns num sized array of random keys from the given array

Parameters:
array - the array from which the keys will come from
num - the number of random keys to return
Returns:
the produce of the array's elements

array_reduce

public static Value array_reduce(Env env,
                                 ArrayValue array,
                                 Callable callable,
                                 Value initialValue)
Returns the value of the array when its elements have been reduced using the callback function.

Parameters:
array - the array to reduce
callback - the function to use for reducing the array
initialValue - used as the element before the first element of the array for purposes of using the callback function
Returns:
the result from reducing the input array with the callback function

array_replace_recursive

public static Value array_replace_recursive(Env env,
                                            Value[] args)
Replace elements in the first array with values from successive ones


array_replace

public static Value array_replace(Env env,
                                  Value[] args)
Replace elements in the first array with values from successive ones


array_reverse

public static Value array_reverse(Env env,
                                  ArrayValue inputArray,
                                  boolean keyed)
Returns the inputted array reversed, preserving the keys if keyed is true

Parameters:
inputArray - the array to reverse
keyed - true if the keys are to be preserved
Returns:
the array in reverse

array_search

public static Value array_search(Env env,
                                 Value needle,
                                 ArrayValue array,
                                 boolean strict)
Returns the key of the needle being searched for or false if it's not found

Parameters:
needle - the value to search for
array - the array to search
strict - checks for type aswell
Returns:
the key of the needle

array_shift

public static Value array_shift(Env env,
                                Value value)
Shifts the elements in the array left by one, returning the leftmost value

Parameters:
array - the array to shift
Returns:
the left most value in the array

array_slice

public static Value array_slice(Env env,
                                ArrayValue array,
                                int offset,
                                Value length,
                                boolean isPreserveKeys)
Returns a chunk of the array. The offset is the start index, elements is the number of values to take, and presKeys is if the keys are to be preserved. If offset is negative, then it's that number from the end of the array. If elements is negative, then the new array will have from offset to elements number of values.

Parameters:
array - the array to take the chunk from
offset - the start index for the new array chunk
elements - the number of elements in the array chunk
presKeys - true if the keys of the elements are to be preserved, false otherwise
Returns:
the array chunk

array_splice

public static Value array_splice(Env env,
                                 Value arrayVar,
                                 int offset,
                                 Value length,
                                 Value replace)
Returns the removed chunk of the arrayV and splices in replace. If offset is negative, then the start index is that far from the end. Otherwise, it is the start index. If length is not given then from start index to the end is removed. If length is negative, that is the index to stop removing elements. Otherwise that is the number of elements to remove. If replace is given, replace will be inserted into the arrayV at offset.

Parameters:
array - the arrayV to splice
offset - the start index for the new arrayV chunk
length - the number of elements to remove / stop index
replace - the elements to add to the arrayV
Returns:
the part of the arrayV removed from input

spliceImpl

public static Value spliceImpl(Env env,
                               Value var,
                               ArrayValue array,
                               int start,
                               int end,
                               ArrayValue replace)

array_sum

public static Value array_sum(Env env,
                              ArrayValue array)
Returns the sum of the elements in the array

Parameters:
array - the array to sum
Returns:
the sum of the elements

array_udiff_assoc

public static Value array_udiff_assoc(Env env,
                                      Value[] arrays)
Creates an array with all the values of the first array that are not present in the other arrays, using a provided callback function to determine equivalence. Also checks the key for equality using an internal comparison function.

Parameters:
arrays - first array is checked against the rest. Last element is the callback function.
Returns:
an array with all the values of the first array that are not in the rest

array_udiff_uassoc

public static Value array_udiff_uassoc(Env env,
                                       Value[] arrays)
Creates an array with all the values of the first array that are not present in the other arrays, using a provided callback function to determine equivalence. Also checks keys using a provided callback function.

Parameters:
arrays - first array is checked against the rest. Last two elementare the callback functions.
Returns:
an array with all the values of the first array that are not in the rest

array_udiff

public static Value array_udiff(Env env,
                                Value[] arrays)
Creates an array with all the values of the first array that are not present in the other arrays, using a provided callback function to determine equivalence.

Parameters:
arrays - first array is checked against the rest. Last element is the callback function.
Returns:
an array with all the values of the first array that are not in the rest

array_uintersect_assoc

public static Value array_uintersect_assoc(Env env,
                                           Value[] arrays)
Creates an array with all the values of the first array that are present in the other arrays, using a provided callback function to determine equivalence. Also checks the keys for equivalence using an internal comparison.

Parameters:
arrays - first array is checked against the rest. Last element is the callback function.
Returns:
an array with all the values of the first array that are in the rest

array_uintersect_uassoc

public static Value array_uintersect_uassoc(Env env,
                                            Value[] arrays)
Creates an array with all the values of the first array that are present in the other arrays, using a provided callback function to determine equivalence. Also checks the keys for equivalence using a pass callback function

Parameters:
arrays - first array is checked against the rest. Last two elements are the callback functions.
Returns:
an array with all the values of the first array that are in the rest

array_uintersect

public static Value array_uintersect(Env env,
                                     Value[] arrays)
Creates an array with all the values of the first array that are present in the other arrays, using a provided callback function to determine equivalence.

Parameters:
arrays - first array is checked against the rest. Last element is the callback function.
Returns:
an array with all the values of the first array that are in the rest

array_unique

public static Value array_unique(Env env,
                                 ArrayValue array)
Returns the inputted array without duplicates

Parameters:
array - the array to get rid of the duplicates from
Returns:
an array without duplicates

array_unshift

public static Value array_unshift(Env env,
                                  Value value,
                                  Value[] values)
Prepends the elements to the array

Parameters:
array - the array to shift
values -
Returns:
the left most value in the array

array_values

public static Value array_values(Env env,
                                 ArrayValue array)
Returns the values in the passed array with numerical indices.

Parameters:
array - the array to get the values from
Returns:
an array with the values of the passed array

array_walk_recursive

public static boolean array_walk_recursive(Env env,
                                           Value arrayVar,
                                           Callable callback,
                                           Value extra)
Recursively executes a callback function on all elements in the array, including elements of elements (i.e., arrays within arrays). Returns true if the process succeeded, otherwise false.

Parameters:
array - the array to walk
call - the name of the callback function
extra - extra parameter required by the callback function
Returns:
true if the walk succedded, false otherwise

array_walk

public static boolean array_walk(Env env,
                                 Value arrayVar,
                                 Callable callback,
                                 Value userData)
Executes a callback on each of the elements in the array.

Parameters:
array - the array to walk along
callback - the callback function
userData - extra parameter required by the callback function
Returns:
true if the walk succeeded, false otherwise

arsort

public static boolean arsort(Env env,
                             Value arrayVar,
                             long sortFlag)
Sorts the array based on values in reverse order, preserving keys

Parameters:
array - the array to sort
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

asort

public static boolean asort(Env env,
                            Value arrayVar,
                            long sortFlag)
Sorts the array based on values in ascending order, preserving keys

Parameters:
array - the array to sort
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

compact

public static ArrayValue compact(Env env,
                                 Value[] variables)
Creates an array of corresponding values to variables in the symbol name. The passed parameters are the names of the variables to be added to the array.

Parameters:
variables - contains the names of variables to add to the array
Returns:
an array with the values of variables that match those passed

count

public static long count(Env env,
                         Value value,
                         int countMethod)
Returns the size of the array.


current

public static Value current(Value value)
Returns the current value of the array.


each

public static Value each(Env env,
                         Value value)
Returns the next value of the array.


end

public static Value end(Value value)
Resets the pointer to the end


extract

public static Value extract(Env env,
                            ArrayValue array)
Inputs new variables into the symbol table from the passed array

Parameters:
array - the array contained the new variables
Returns:
the number of new variables added from the array to the symbol table

extract

public static Value extract(Env env,
                            ArrayValue array,
                            long rawType,
                            Value valuePrefix)
Inputs new variables into the symbol table from the passed array

Parameters:
array - the array contained the new variables
rawType - flag to determine how to handle collisions
valuePrefix - used along with the flag
Returns:
the number of new variables added from the array to the symbol table

in_array

public static boolean in_array(Value needle,
                               ArrayValue stack,
                               boolean strict)
Determines if the key is in the array

Parameters:
needle - the array to sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

key

public static Value key(Value value)
Returns the current key of the array.


key_exists

public static boolean key_exists(Env env,
                                 Value key,
                                 Value searchArray)
Undocumented alias for array_key_exists(com.caucho.quercus.env.Env, com.caucho.quercus.env.Value, com.caucho.quercus.env.Value).


krsort

public static boolean krsort(Env env,
                             Value arrayVar,
                             long sortFlag)
Sorts the array based on keys in reverse order, preserving keys

Parameters:
array - the array to sort
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

ksort

public static boolean ksort(Env env,
                            Value arrayVar,
                            long sortFlag)
Sorts the array based on keys in ascending order, preserving keys

Parameters:
array - the array to sort
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

natcasesort

public static Value natcasesort(Env env,
                                Value arrayVar)
Sorts the array based on string values using natural order, preserving keys, case insensitive

Parameters:
array - the array to sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

natsort

public static Value natsort(Env env,
                            Value arrayVar)
Sorts the array based on string values using natural order, preserving keys, case sensitive

Parameters:
array - the array to sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

next

public static Value next(Value value)
Returns the next value of the array.


pos

public static Value pos(Value value)
Returns the current value of the array.


prev

public static Value prev(Value array)
Returns the previous value of the array.


range

public static Value range(Env env,
                          Value start,
                          Value end,
                          long step)
Creates an array using the start and end values provided

Parameters:
start - the 0 index element
end - the length - 1 index element
step - the new value is increased by this to determine the value for the next element
Returns:
the new array

reset

public static Value reset(Value array)
Resets the pointer


rsort

public static boolean rsort(Env env,
                            Value arrayVar,
                            long sortFlag)
Sorts the array based on values in reverse order

Parameters:
array - the array to sort
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

shuffle

public static Value shuffle(Env env,
                            Value array)
Returns the current value of the array.


sizeof

public static long sizeof(Env env,
                          Value value,
                          int countMethod)
Returns the size of the array.


sort

public static boolean sort(Env env,
                           Value arrayVar,
                           long sortFlag)
Sorts the array based on values in ascending order

Parameters:
array - the array to sort
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

uasort

public static boolean uasort(Env env,
                             Value arrayVar,
                             Callable func,
                             long sortFlag)
Sorts the array based on values in ascending order using a callback function

Parameters:
array - the array to sort
func - the name of the callback function
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

uksort

public static boolean uksort(Env env,
                             Value arrayVar,
                             Callable func,
                             long sortFlag)
Sorts the array based on values in ascending order using a callback function

Parameters:
array - the array to sort
func - the name of the callback function
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable

usort

public static boolean usort(Env env,
                            Value arrayVar,
                            Callable func,
                            long sortFlag)
Sorts the array based on values in ascending order using a callback function

Parameters:
array - the array to sort
func - the name of the callback function
sortFlag - provides optional methods to process the sort
Returns:
true if the sort works, false otherwise
Throws:
java.lang.ClassCastException - if the elements are not mutually comparable