array_pop
arrayRemoves and returns the last element of an array
Syntax
array_pop(array) Parameters
array (array) The array to remove the last element from
Returns
array A new array with the last element removed
Examples
Input:
[1, 2, 3] | array_pop Output:
[1, 2] Input:
["a", "b", "c"] | array_pop Output:
["a", "b"] The array_pop() function removes the last element from an array and returns the resulting array without that element.
Usage
This function is useful for removing trailing elements, truncating lists, or processing stacks from the end.