PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular

array_pop

Tags: PHP 5.x PHP 7.x PHP 8.x

array_pop — Pop the element off the end of array.

Description

array_pop(
    array &$array
): mixed
array_pop() pops and returns the value of the last element of array, shortening the array by one element.

Note: This function will reset() the array pointer of the input array after use.

Parameters

array
The array to get the value from.

Return Values

Returns the value of the last element of array. If array is empty (or is not an array), null will be returned.

array_pop - New snippets