PHP end() Function

The end( ) function is an inbuilt function of PHP. The end() function Set the internal pointer of an array to its last element. This function was introduced in 4.0.

Syntax

Parameter

ParameterDescriptionIs compulsory
arraySpecifies the array to use.compulsory

Returns

The end( ) function returns the value of the last element in the array on success or false if the array is empty.

Example 1

Output:

sehwag

Example 2

Output:

java

Example 3

Output:

ajay

Example 4

Output:

hockeycricketer