PHP next array function

Last Updated: February 21, 2022

next – Move internal pointer to the next element of the array

Syntax

 next(array|object &$array): mixed

Supports (PHP 4 , PHP 5, PHP 7, PHP 8)

Parameters

Parameter Description
array input array

Return Value

Return the value of the array of the next location. If no element is found it will return false

Example

$array1 = array('a', 'c', 'b', 'D', 'E', 'F');

current($array1); //  'a';
echo next($array1);    // 'c';

Output

c

Test