PHP kernel in-depth study-arrays and their traversal order

Source: Internet
Author: User

In fact, broadly speaking, PHP is a C language application on the Web Template, php smarty template used more, like JSP is a Java servlet template (oh, yes, JSP has a jstl tag), complex template syntax is difficult to be welcomed by developers.

In PHP, arrays are implemented using Hashtable. PHP uses a number of mechanisms that allow for the addition and deletion of arrays in the time Complexity of O (1), while supporting both linear traversal and random access.

The order in which foreach iterates through an array in PHP is related to the order in which the elements are added.

If you want to traverse the index size in an array of numeric indexes, you should use for instead of foreach.

RELATED links:

http://yanpeipan.github.io/2014/12/18/understandable PHP array/

Http://www.laruence.com/2009/08/23/1065.html

PHP kernel in-depth study-arrays and their traversal order

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.