First of all, it is said that the PHP array is copied from the PERL array, but its usage is simplified. To access an array, the members are: $ array name [key name] or $ array name {key name}. in PERL, [] indexes refer to arrays, {} is dedicated to hash arrays. But I guess there are some problems with accessing the P PHP array.
First, it is said that the PHP array is copied from the PERL array, but its use is simplified.
To access the members in an array, the following are required:
$ Array name [key name]
Or
$ Array name {key name}
In PERL, [] indexes refer to arrays, and {} is dedicated to hash arrays.
However, the {} index method is not described in the official PHP documentation. It only exists in the user comment. Naturally, I think these users must have read the PHP source code. It may be inadvertently tested.
But in any case, if you don't look at the source code, you won't be able to tell the real difference between the two.
?
In addition, you can use arrays to access a single character in a string. However, if the variable is empty. Write a string into the array.
?
For strings, I personally prefer {} type index access. The fundamental purpose of this operation is to distinguish it from an array. Indicates that this variable is a string.
?
For the difference between [] and {}, you need to check the source code later. Make only some records.