Skip to content
PHP Ecosystem
Explore

ArrayHelper

API reference › yii › helpers › ArrayHelper

classyii\helpers\ArrayHelper
ExtendsBaseArrayHelper
Since2.0
Sourceframework/helpers/ArrayHelper.php

ArrayHelper provides additional array functionality that you can use in your application.

For more details and usage information on ArrayHelper, see the guide article on array helpers.

MethodDescriptionDefined by
filter() staticFilters array according to rules specified.BaseArrayHelper
flatten() staticFlattens a multidimensional array into a one-dimensional array.BaseArrayHelper
getColumn() staticReturns the values of a specified column in an array.BaseArrayHelper
getValue() staticRetrieves the value of an array element or object property with the given key or property name.BaseArrayHelper
htmlDecode() staticDecodes HTML entities into the corresponding characters in an array of strings.BaseArrayHelper
htmlEncode() staticEncodes special characters in an array of strings into HTML entities.BaseArrayHelper
index() staticIndexes and/or groups the array according to a specified key.BaseArrayHelper
isAssociative() staticReturns a value indicating whether the given array is an associative array.BaseArrayHelper
isIn() staticCheck whether an array or Traversable contains an element.BaseArrayHelper
isIndexed() staticReturns a value indicating whether the given array is an indexed array.BaseArrayHelper
isSubset() staticChecks whether an array or Traversable is a subset of another array or Traversable.BaseArrayHelper
isTraversable() staticChecks whether a variable is an array or Traversable.BaseArrayHelper
keyExists() staticChecks if the given array contains the specified key.BaseArrayHelper
map() staticBuilds a map (key-value pairs) from a multidimensional array or an array of objects.BaseArrayHelper
merge() staticMerges two or more arrays into one recursively.BaseArrayHelper
multisort() staticSorts an array of objects or arrays (with the same structure) by one or several keys.BaseArrayHelper
recursiveSort() staticSorts array recursively.BaseArrayHelper
remove() staticRemoves an item from an array and returns the value. If the key does not exist in the array, the default value will be returned instead.BaseArrayHelper
removeValue() staticRemoves items with matching values from the array and returns the removed items.BaseArrayHelper
setValue() staticWrites a value into an associative array at the key path specified.BaseArrayHelper
toArray() staticConverts an object or an array of objects into an array.BaseArrayHelper