array_pop() function in php || array pop function in php
×


array_pop() function in php

0 575

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:


Leave a Reply


Comments
    Waiting for your comments