Array & List Functions
- ADD_TO_ARRAY
Adds values to an array
ADD_TO_ARRAY([1,2,3],4,5)Try this examplearray (array)Initial arrayvalue1 (mixed)Element to add - ARRAY_CHANGE_KEY_CASE
Changes the case of all keys in an array
ARRAY_CHANGE_KEY_CASE([1,2,3])Try this examplearray (array)The array to work oncase (string)Allowed values: "upper", "lower" (default) - ARRAY_CHUNK
Split an array into chunks
ARRAY_CHUNK([1,2,3],1)Try this examplearray (array)The array to work onsize (number)The size of each chunk - ARRAY_COLUMN
Return the values from a single column in the input array
ARRAY_COLUMN({var1},"username")Try this exampleinput (array)A multi-dimensional array or an array of objects from which to pull a column of values from.column_key (any)The column of values to return. This value may be an integer key of the column you wish to retrieve, or it may be a string key name for an associative array or property name. - ARRAY_COMBINE
Creates an array by using one array for keys and another for its values
ARRAY_COMBINE([1,2,3],[4,5,6])Try this examplekeys (array)Array of keys to be used. Illegal values for key will be converted to string.values (array)Array of values to be used - ARRAY_COUNT_VALUES
Counts all the values of an array
ARRAY_COUNT_VALUES([1,2,3,1])Try this examplearray (array)The array of values to count - ARRAY_DIFF
Computes the difference of arrays
ARRAY_DIFF({var1},{var2})Try this examplearray1 (array)The array to compare fromarray2 (array)An array to compare against - ARRAY_DIFF_ASSOC
Computes the difference of arrays with additional index check
ARRAY_DIFF_ASSOC({var1},{var2})Try this examplearray1 (array)The array to compare fromarray2 (array)An array to compare against - ARRAY_DIFF_KEY
Computes the difference of arrays using keys for comparison
ARRAY_DIFF_KEY({var1},{var2})Try this examplearray1 (array)The array to compare fromarray2 (array)An array to compare against - ARRAY_FILL
Fill an array with values
ARRAY_FILL(5,6,"banana")Try this examplestart_index (number)The first index of the returned array.num (number)Number of elements to insert. Must be greater than or equal to zero. - ARRAY_FILL_KEYS
Fill an array with values, specifying keys
ARRAY_FILL_KEYS([1,2,3],"value")Try this examplekeys (array)Array of values that will be used as keys. Illegal values for key will be converted to string.value (string)Value to use for filling - ARRAY_FLIP
Exchanges all keys with their associated values in an array
ARRAY_FLIP([1,2,3])Try this examplearray (array)An array of key/value pairs to be flipped. - ARRAY_INTERSECT
Computes the intersection of arrays
ARRAY_INTERSECT({var1},{var2})Try this examplearray1 (array)The array with master values to check.array2 (array)An array to compare values against. - ARRAY_INTERSECT_ASSOC
Computes the intersection of arrays with additional index check
ARRAY_INTERSECT_ASSOC({var1},{var2})Try this examplearray1 (array)The array with master values to check.array2 (array)An array to compare values against. - ARRAY_INTERSECT_KEY
Computes the intersection of arrays using keys for comparison
ARRAY_INTERSECT_KEY({var1},{var2})Try this examplearray1 (array)The array with master keys to check.array2 (array)An array to compare keys against. - ARRAY_KEY_EXISTS
Checks if the given key or index exists in the array
ARRAY_KEY_EXISTS("1",[1,2,3])Try this examplekey (any)Value to check.array (array)An array with keys to check. - ARRAY_KEY_FIRST
Gets the first key of an array
ARRAY_KEY_FIRST([1,2,3])Try this examplearray (array)An array. - ARRAY_KEY_LAST
Gets the last key of an array
ARRAY_KEY_LAST()Try this examplearray (array)An array. - ARRAY_KEYS
Return all the keys or a subset of the keys of an array
ARRAY_KEYS([1,2,3])Try this examplearray (array)An array containing keys to return. - ARRAY_MERGE
Merge one or more arrays
ARRAY_MERGE([1,2,3],[4,5,6])Try this examplevalue1 (mixed)Variable list of arrays to merge.value2 (mixed)Variable list of arrays to merge. - ARRAY_MERGE_RECURSIVE
Merge one or more arrays recursively
ARRAY_MERGE_RECURSIVE({var1},{var2})Try this examplevalue1 (mixed)Variable list of arrays to recursively merge.value2 (mixed)Variable list of arrays to recursively merge. - ARRAY_PAD
Pad array to the specified length with a value
ARRAY_PAD()Try this examplearray (array)Initial array of values to pad.size (number)New size of the array. - ARRAY_POP
Pop the element off the end of array
ARRAY_POP([1,2,3])Try this examplearray (array)The array to get the value from. - ARRAY_PUSH
Push one or more elements onto the end of array
ARRAY_PUSH([1,2,3],4)Try this examplearray (array)The input array.item (mixed)The values to push onto the end of the array. - ARRAY_RAND
Pick one or more random keys out of an array
ARRAY_RAND([1,2,3],2)Try this examplearray (array)The input array.num (number)Specifies how many entries should be picked. - ARRAY_REPLACE
Replaces elements from passed arrays into the first array
ARRAY_REPLACE({var1},{var2})Try this examplearray1 (array)The array in which elements are replaced.array2 (array)Arrays from which elements will be extracted. Values from later arrays overwrite the previous values. - ARRAY_REPLACE_RECURSIVE
Replaces elements from passed arrays into the first array recursively
ARRAY_REPLACE_RECURSIVE({var1},{var2})Try this examplearray1 (array)The array in which elements are replaced.array2 (array)Optional. Arrays from which elements will be extracted. - ARRAY_REVERSE
Return an array with elements in reverse order
ARRAY_REVERSE()Try this examplearray (array)The input array. - ARRAY_SEARCH
Searches the array for a given value and returns the first corresponding key if successful
ARRAY_SEARCH()Try this exampleneedle (any)The searched value.haystack (array)The array. - ARRAY_SHIFT
Shift an element off the beginning of array
ARRAY_SHIFT()Try this examplearray (array)The input array. - ARRAY_SLICE
Extract a slice of the array
ARRAY_SLICE([1,2,3,4,5],0,1)Try this examplearray (array)The input array.offset (number)If offset is non-negative, the sequence will start at that offset in the array. If offset is negative, the sequence will start that far from the end of the array. - ARRAY_SPLICE
Remove a portion of the array and replace it with something else
ARRAY_SPLICE([1,2,3,4],1,1)Try this exampleinput (array)The input array.offset (number)If offset is positive then the start of the removed portion is at that offset from the beginning of the input array. If offset is negative then the start of the removed portion is at that offset from the end of the input array. - ARRAY_SUM
Calculate the sum of values in an array
ARRAY_SUM([1,2,3,4])Try this examplearray (array)The input array. - ARRAY_UNIQUE
Removes duplicate values from an array
ARRAY_UNIQUE([1,2,2,3,3])Try this examplearray (array)The input array. - ARRAY_UNSHIFT
Prepend one or more elements to the beginning of an array
ARRAY_UNSHIFT([1,2,3],1)Try this examplearray (array)The input array.value (mixed)The values to prepend. - ARRAY_VALUES
Return all the values of an array
ARRAY_VALUES({var1})Try this examplearray (array)The array. - ARSORT
Sort an array in reverse order and maintain index association
ARSORT({var1})Try this examplearray (array)The input array. - ASORT
Sort an array and maintain index association
ASORT({var1})Try this examplearray (array)The input array. - CONCAT_ARRAY
Method is used to join two or more arrays.
CONCAT_ARRAY([1,2,3],[4,5,6])Try this examplearray1 (array)First arrayarray2 (array)Optional: second array - CONTAINS_ARRAY
Determines whether a value exists in array
CONTAINS_ARRAY([1,2,3],1)Try this examplearray (array)Initial arrayvalue (any)Value to search in array - COUNT_ARRAY_ELEMENTS
Count all elements in an array, or something in an object
COUNT_ARRAY_ELEMENTS([1,2,3,4])Try this examplearray_or_countable (array)An array or Countable object. - DISTINCT
Removes duplicates elements in array.
DISTINCT([1,2,2])Try this examplearray (array)Initial array - EXPLODE
Split a string by a string
EXPLODE("-","1-2-3")Try this exampledelimiter (string)The boundary string.string (string)The input string. - FILL
Fills the specified elements in an array with a static value.
FILL([1,2,3],4)Try this examplearray (array)Initial arrayvalue (any)The value to fill the array with - FIRST
Returns first element value from array or object
FIRST([1,2,3])Try this example - FLATTEN
Creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.
FLATTEN([1,2,[3,4]])Try this example - GET
Returns value from array or object by a specific key
GET({"a":1,"b":2},"a")Try this example - GET_COMPLEX
Returns value from object by a specific deep key
GET_COMPLEX({"a":{"b":1,"c":2},"d":2},"a.b")Try this example - IMPLODE
Join array elements with a string
IMPLODE(",",[1,2,3])Try this exampleglue (string)Defaults to an empty string.pieces (array)The array of strings to implode. - IN_ARRAY
Checks if a value exists in an array
IN_ARRAY(1,[1,2,3])Try this exampleneedle (any)The searched value. If needle is a string, the comparison is done in a case-sensitive manner.haystack (any)The array. - INDEXOF_ARRAY
Searches the array for the specified item, and returns its position.
INDEXOF_ARRAY([1,2,3],3)Try this examplearray (array)Initial arrayvalue (any)The item to search for - ISARRAY
Determines whether an object is an array.
ISARRAY([1,2,3])Try this examplearray (array)Initial array - JOIN
Concatenate all the elements of array into a one string with a string
JOIN([1,2,3],"-")Try this examplearray (array)Initial arrayseparator (string)String as glue - JOIN_ARRAY
Join array elements with a string
JOIN_ARRAY(",",[1,2,3])Try this exampleglue (string)Defaults to an empty string.pieces (array)The array of strings to implode. - KEY_EXISTS
Checks if the given key or index exists in the array
KEY_EXISTS(1,[1,2,3])Try this examplekey (any)Value to check.array (array)An array with keys to check. - KEYS
Return all the keys or a subset of the keys of an array
KEYS({var1})Try this exampleobject (array)Initial array or object - KRSORT
Sort an array by key in reverse order
KRSORT({var1})Try this examplearray (array)The input array. - KSORT
Sort an array by key
KSORT({var1})Try this examplearray (array)The input array. - LENGTH_ARRAY
Count all elements in an array, or something in an object
LENGTH_ARRAY([1,2,3])Try this examplearray (array)Initial array - MERGE
Merge one or more arrays
MERGE([1,2,3],[4,5,6])Try this examplearray1 (array)First arrayarray2 (array)Second array - NATCASESORT
Sort an array using a case insensitive "natural order" algorithm
NATCASESORT({var1})Try this examplearray (array)The input array. - NATSORT
Sort an array using a "natural order" algorithm
NATSORT({var1})Try this examplearray (array)The input array. - POP
Removes the last element of an array
POP([1,2,3])Try this examplearray (array)Initial array - PUSH
Adds new items to the end of an array
PUSH([1,2,3],4)Try this examplearray (array)Initial arrayelement (any)The item to add to the array - RANGE
Create an array containing a range of elements
RANGE(1,3)Try this examplestart (any)First value of the sequence.end (any)The sequence is ended upon reaching the end value. - REMOVE
Removes elements from array by value
REMOVE([1,2,3],1)Try this examplearray (array)Initial arrayvalue (any)Value to remove from array - REVERSE
Return an array with elements in reverse order
REVERSE([1,2,3])Try this examplearray (array)Initial array - RSORT
Sort an array in reverse order
RSORT({var1})Try this examplearray (array)The input array. - SHIFT
Removes the first item of an array.
SHIFT([1,2,3])Try this examplearray (array)Initial array - SHUFFLE
Shuffle an array
SHUFFLE([1,2,3])Try this examplearray (array)The array. - SIZEOF
Count all elements in an array, or something in an object
SIZEOF([1,2,3])Try this examplearray_or_countable (array)An array or Countable object. - SLICE
Extract a slice of the array
SLICE([1,2,3],0,1)Try this examplearray (array)Initial arraystart (number)Start index, first index 1 - SORT
Sorts values of array.
SORT([1,2,3],"ASC")Try this examplearray (array)Initial arrayorder (string)Acceptable values: "ASC", "DESC" - SORT_ARRAY
Sort an array
SORT_ARRAY([3,1,2])Try this examplearray (array)The input array.