Skip to content
PHP

array functions API Reference

PHP's built-in array functions — PHP arrays serve as both lists and ordered maps.

By EZ4Code Team

array functions

Procedural array functions for manipulating PHP's versatile array type.

array_push(array &$array, mixed ...$values): int

Pushes one or more elements onto the end of array. Returns the new number of elements.

Returns: int

array_pop(array &$array): mixed|null

Pops and returns the last value of the array, shortening it by one element.

Returns: mixed|null

count(Countable|array $value, int $mode = COUNT_NORMAL): int

Counts all elements in an array or Countable object.

Returns: int

array_map(?callable $callback, array $array, array ...$arrays): array

Applies the callback to the elements of the given arrays and returns a new array.

Returns: array

array_filter(array $array, ?callable $callback = null, int $mode = 0): array

Filters elements of an array using a callback. Without a callback, removes falsy values.

Returns: array

array_merge(array ...$arrays): array

Merges the elements of one or more arrays together. Re-indexes numeric keys.

Returns: array

in_array(mixed $needle, array $haystack, bool $strict = false): bool

Checks if a value exists in an array. Use strict=true for type-safe comparison.

Returns: bool

More PHP API References