PHP next() Function

6 Jan 2025 | 1 min read

The PHP next( ) function is used to advance the internal array pointer. It advances the internal array pointer one place forward before returning the element value. This function was introduced in PHP 4.0.

Syntax

Parameter

ParameterDescriptionIs compulsory
arraySpecifies the array to use.compulsory

Returns

The PHP next( ) function returns the value of the next element in the array on success or false if there are no more elements.

Example 1

Output:

 T 

Example 2

Output:

 java c 

Example 3

Output:

 java c os 

Example 4

Output:

 youtube fb youtube fb