Web | This Site

Learning PHP
Advanced PHP
PHP Function Reference
PHP Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# 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.

## Paramters

Parameter | Description
--- | ---
array | Required. Specifies an array

## Return Value

Returns the next element in an array.

## Example

Try out following example:

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

This will produce following result:

    foot
    bike
    bike
    foot
    plane
    plane

Advertisement

Online Image Processing

Indian Baby Names