PHP reset() Function (original) (raw)

Last Updated : 20 Jun, 2023

The reset() function is an inbuilt function in PHP.

Syntax:

reset($array)

Parameters: This function accepts a single parameter $array. It is the array for which we want to reset the internal pointer to point to the first element again.Return Value: It returns the first element of the array on success, or FALSE if the array is empty i.e, the array does not contain any element. Below programs illustrate the reset() function in PHP:Program 1:

php `

res=reset(res = reset(res=reset(arr); print "$res"; ?>

`

Output:

Ram

Program 2:

php `

`

Output:

Delhi Kolkata Delhi

Reference: https://www.php.net/manual/en/function.reset.php