PHP array_pop() Function

The array_pop function is used to remove the last array element. This function has to use one argument that is array name and also this array function return one returns values.

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

Parameter Description
array Required. Specifies an array

Syntax

 array_pop(array) 

Example

$array = array("Cooper","Samuel","James","Alex");
array_pop($array);
print_r($array);

Output

Array ( [0] => Cooper [1] => Samuel [2] => James ) 

Leave a Reply

Your email address will not be published. Required fields are marked *