• PHP Video Tutorials

PHP - Function next()



Syntax

next ( $array );

Definition and Usage

The next() function returns the array value in the next place that's pointed to by the internal array pointer, or FALSE if there are no more elements.

Parameters

Sr.No Parameter & Description
1

array(Required)

It specifies an array

Return Value

It returns the next element in an array.

Example

Try out following example −

<?php
   $input = array('foot', 'bike', 'car', 'plane');
   $mode = current($input); 
   print "$mode <br />";
   
   $mode = next($input);
   print "$mode <br />";
   
?> 

This will produce the following result −

foot
bike
php_function_reference.htm
Advertisements