Array verbose logging

Source: Internet
Author: User
Tags pear

Several formats for arrays
    • 1. Index type , example 1: $A =array (12,5,21,90); #索引为纯数字0, ....
    • 2. Association type , which is the style of key->value.
    • Example 2: $B =array ("apple" = "apple", "pear" and "pear");
    • 3. Index and association Mix , Example: $C =array ("Watermelon" and "watermelon", "apple", "lemon" and "lemon");
    • * Note: Types 2 and 3 can all be collectively referred to as associative arrays.

Now there is a problem, if the integer value as key, then how to calculate the remaining?
Examples: $D =array (2=> "Apple", "orange", "banana", "watermelon" and "watermelon");

Q: How much is the Orange key?

Solution: If an integer index, starting from this integer calculation, the above example array is starting from 2 index, the Orange key is 3, and so on, when there is a definite key, it is ignored, such as "Watermelon" and "watermelon", its key is watermelon.

The starting index of the $D is 2, if index $d[0] or $d[1], then there is no definition of the error.

In other words, if an explicitly specified Key,key is an explicitly specified value, it is specified by the compiler by default if it is not explicitly specified.

Array verbose logging

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