PHP Array function sequence next ()-Moves the inner pointer of the array to the position of the next element and returns the element value _php tutorial

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. Specifies the array to use.

Description
Next () and current () behave similarly, with only a little difference, moving the inner pointer forward one bit before the return value. 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 outside the end of the array cell, next () returns FALSE.

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

Example
Copy CodeThe code is as follows:
$people = Array ("Peter", "Joe", "Glenn", "Cleveland");

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

Output:

Peter
Joe

http://www.bkjia.com/PHPjc/324477.html www.bkjia.com true http://www.bkjia.com/PHPjc/324477.html techarticle Next () defines and uses 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 has exceeded the last element of the array ...

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