PHP end() function

PHP end() function

The end() function in PHP sets the internal pointer of an array to its last element. This function returns the value of the last element

Syntax

end ( array &$array )  

Parameter

array (required)– This parameter represents the input array.

Return

This function returns the value of the last element or FALSE for an empty array.

Example 1

 

Output

The end element of the array: pear

Example 2

 

Output

The current point is at Mango
The end element is at Apple 

Example 3

 

Output

Mango
Banana
Mango
Apple