PHP reset() Function

6 Jan 2025 | 1 min read

The PHP reset( ) function is used to move the array's internal pointer to the first element. This function was introduced in PHP 4.0.

Syntax

Parameter

ParameterDescriptionIs compulsory
arraySpecifies the array to use.compulsory

Returns

The reset( ) function returns the value of the first array element or false if the array is empty.

Example 1

Output:

 sachin 

Example 2

Output:

 cat dog cat 

Example 3

Output:

 os dbms java 

Example 4

Output:

 os dbms os java