PHP Array end() Function

What is end() Function?

Explanation

The "end()" function sets the internal pointer of an array to its last element.

Syntax:


end(array)

In the above syntax "array" is the array in which the internal pointer is set to the last element, and displays it.

Example :


<?php
$b=array("Grapes","Apple","Cherry");
echo(end($b));
?>
Result :

Cherry

In the above example the last element of the array "$b" is displayed, as the function moves the internal pointer to the last element.

PHP Topics


Ask Questions

Ask Question