Php array Getting Started Tutorial on array pointer operations

Source: Internet
Author: User
Php array Getting Started Tutorial on array pointer operations
This article introduces the content related to array pointers in php arrays. For more information, see.

In php, functions involving array pointers include reset, prev, end, next, current, and each.

Example 1: next and prev

     "; Echo prev ($ speed); // outputs the array value echo in the previous position"
"; Echo reset ($ speed); // reset the array pointer to point the pointer to the starting position echo"
"; Echo end ($ speed); // output the array value at the last position echo"
"; // By>

Result: 02202000220

Example 2: each function pointer operation

     "; Echo" 0 speed is ". current (each ($ speed ))."
"; Echo" 1 speed is ". current (each ($ speed ))."
"; Echo" 2 speed is ". current (each ($ speed ))."
"; Echo" 3 speed is ". current (each ($ speed ))."
"; Echo" the speed of 4 blocks is ". current (each ($ speed ))."
"; Echo" 5 speed is ". current (each ($ speed ))."
"; Echo" use the each function to move the array pointer and traverse the array.
"; Reset ($ speed); // Here, the array pointer is directed to the first while (list ($ key, $ value) = each ($ speed) {echo $ key. "=> ". $ value."

Running result: the speed at which the each pointer moves down 0 blocks is 01 block speed is 402 block speed is 803 block speed is 1204 block speed is 1605 block speed is 200 Block speed is use each function to implement array pointer movement, array traversal 0 => 01 => 402 => 803 => 1204 => 1605 => 200

Related Article

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