PHP Array end() Function
Last Updated : 17 Mar 2025
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
Next TopicPhp-array-extract-function