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

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

The function returns False if the inner pointer has already exceeded the first element of the array.

Grammar
Prev (array) parameter description
Array required. Specifies the array to use.

Description
The behavior of Prev () and Next () is similar, but it returns the internal pointer back to one instead of a forward position.

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). "
";
Echo prev ($people);
?>

Output:

Peter
Joe
Peter

http://www.bkjia.com/PHPjc/324474.html www.bkjia.com true http://www.bkjia.com/PHPjc/324474.html techarticle The prev () Definition and Usage prev () function moves a pointer to the current element to the position of the previous element and returns the element value. If the inner pointer has exceeded the first 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.