Account
Categories

array_pop()


This function is the opposite of array_push(). When you use this function on an array, it removes the last value from that array and decreases the array's length by one.

Syntax:

array_pop($array_name);

Example:

$fruits = array("Apple", "Banana", "Mango");
array_pop($fruits);
print_r($fruits);

Output:

Array
(
    [0] => Apple
    [1] => Banana
)