PHP Array function sequence next ()-Moves an array's internal pointer to the next element's position and returns the element value _php tips

Source: Internet
Author: User
Next () Definition and usage
The next () function moves the pointer to the current element to the position of the next element and returns the value of the element.

If the internal pointer already exceeds the last element of the array, the function returns FALSE.

Grammar
Next (array) parameter description
Array required. Specify the array to use.

Description
The behavior of next () and current () is similar, with only one point of difference, in which the internal pointer is moved forward one bit before the value is returned. This means that it returns the value of the next array cell and moves the array pointer forward one bit. If the result of moving the pointer is beyond the end of the array cell, next () returns FALSE.

Note: If the array contains empty cells, or if the cell value is 0, the function encounters these cells and returns FALSE. To properly traverse an array that may contain empty cells or a cell value of 0, see the each () function.

Example
Copy Code code as follows:

<?php
$people = Array ("Peter", "Joe", "Glenn", "Cleveland");

Echo current ($people). "<br/>";
Echo Next ($people);
?>

Output:

Peter
Joe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.