Javatpoint Logo
Javatpoint Logo

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

Parameter Description Is compulsory
array Specifies 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





Help Others, Please Share

facebook twitter pinterest