array_pop() function in php
Last Updated by Pooja Chikara
0 3301
array_pop() function of PHP is used to remove the last item of an array. It is an inbuilt function of PHP.
Syntax:
array_pop($arr);
Here
$arr is a php array.
Example:
<?php
$arr1 = array("fruit1"=>"apple","fruit2"=>"banana","fruit3"=>"orange");
echo "<pre>";
echo "Before apply array_pop() function <br>";
print_r($arr1);
array_pop($arr1);
echo "<br> After apply array_pop() function";
print_r($arr1);
?>Output:

Share:
Recommended Topics:
You May Also Like
PHP Examples
News letter
Subscribe To Never Miss an Article From

Comments
Waiting for your comments