PHP array_pop() function

P
PHP array_pad() function
PHP array_product() function

The array_pop function removes the last element of the array.

What is the syntax of the array_pop function in PHP?

array_pop(array)
ParameterDescription
arrayArray to remove the last element from – Required
array_pop function in PHP

Example of array_pop function

<?php
$arr=array("green","blue","red");
array_pop($arr);
print_r($arr);
?>

In the above example, we removed the last element of the array using the array_pop function.

PHP array_pad() function
PHP array_product() function

Add comment

Tutor Network

Share this

Learn PHP from A to Z