PHP array_pop() Function
Last Updated : 17 Mar 2025
The array_pop() function is inbuilt function of PHP. The array_pop() function is used to remove the last element of an array. For an empty array, this function returns NULL. This function was introduced in PHP 4.0.
Syntax
Parameters
| Parameter | Description | Required/Optional |
|---|---|---|
| array | Specifies an array. | compulsory |
Return Type
The array_pop() function returns the last value of array. If the array is empty or is not an array, this method will return NULL.
Example 1
Output:
Array (
[0] => saffron
[1] => white
)
Example 2
Output:
Array
(
[0] =>php
[1] => java
[2] => python
)
Example 3
Output:
Array
(
[1] => 1983
[2] => 2007
)
Example 4
Output:
Array
(
[0] => RBI
[1] => SBI
[2] => ICICI
)
Next TopicPhp-array-pos-function