PHP array_pop() Function

PHP array_pop() Function is used to remove the last element of an array.The array_pop() is a built-in function of PHP.

Syntax :

array_pop(array)

Parameter,

$array : Required  It is type of array parameter.

Return :  It returns array with removed last element. If array is empty, or is not an array, NULL will be returned.

Let's see below example to understand php array_pop() Function in details.

Example :

<?php
echo "<br><br>Deleting last one element from an array.<br>";
$tutorials= array("PHP", "HTML", "JAVASCRIPT", "JAVA", "CSS");
array_pop($tutorials);
print_r($tutorials);
?>

Output :

Comments

Leave a Reply

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

94065