next() function in PHP || PHP Next Function

next() function in php

Last Updated by Pooja Chikara 25-Apr-20

0 365


PHP next() function is used to move the current pointer of an array to the next position and return the value on that position. It is an inbuilt function of PHP.

Syntax:

next($array);

here,

$array is a PHP array.


Example:

<?php
$arr1 = array("apple","orange","banana","fig",);
$next_value=next($arr1);
echo $next_value; // it will print orange
?>

Output:

next() function in php

Note: You should also read current(), prev(), end() and reset() functions.


Share:


Leave a Reply


Comments
    Waiting for your comments