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