Take out the last element of the array and returns the same. After applying array_pop() total elements of the array reduces by one. All numerical array keys remain same as last element is removed. Literal keys remain same.
Returns the shifted element ( last element ) of the array.
Here $input is an array, $output get the value of last element of the array.
$input=array('One','Two','Three','Four');
$output=array_pop($input);
echo $output;// Output : Four
echo "<br><br>";
while (list ($key, $val) = each ($input)) {
echo "$key -> $val <br>";
}
Output of above code is here( $output gets the last element Four )