PHP array_pop function
Last Updated: February 14, 2022
array_pop – pop the element from the top of the array.
Syntax
array_pop(array &$array): mixed
Supports (PHP 4, PHP 5, PHP 7, PHP 8)
Parameters
Parameter | Description |
array | Required. target array |
Return Value
returns the last element of the array
Example
<?php
$input = array("one", "two", "three");
$result = array_pop($input);
print_r($result);
?>
Output
three