PHP array (traversal order)

Source: Internet
Author: User

 

Author:Laruence

Address: http://www.laruence.com/2009/08/23/1065.html

Reprinted please indicate the source

I am often asked if the PHP array is accessed using foreach, is the traversal order fixed? In what order does it traverse?
For example

<?PHP$ Arr['Laruence '] = 'huixinchen';$ Arr['Yahoo '] = 2007;$ Arr['Baidu'] = 2008;Foreach($ Arr As $ Key=>$ Val){//What is the result?}

 

For example:

<?PHP$ Arr[2] = 'huixinchen';$ Arr[1] = 2007;$ Arr[0] = 2008;Foreach($ Arr As $ Key=>$ Val){//What is the result now?}

To fully understand this problem, I would like to first understand the internal implementation structure of the PHP array .........

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

 

 

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.