Php used to only use array (). In the new version, the square brackets []... are used in the phrase method. Isn't the braces {} more in line with the general public? C # int [] array {,}; javaint [] arr {, 0, 0, 0, 0,}; python () tuples... php can only use array = (). square brackets [] are used in the phrase method in the new version. isn't the braces {} more in line with the general public?
C # int [] array = {1, 2, 3, 4, 5, 6 };
Java int [] arr = {0, 0, 0, 0, 0, 0, 0, 0 ,};
The Dictionary of the python () tuples [] list/Array {} is not mixed into one. python is related to php. []
Golang arr: = [...] int {1, 1, 1, 1, 1, 1}
All braces {} contain ,,,
Php uses [] brackets. Is it because {} braces have some special uses in php $ a = "aaaaaa {$ B} aaaaaa"? Are you afraid of ambiguity ?, Otherwise, it is more convenient to press [] brackets than bridge {} braces. shift is not required.
Guess it !!! I just don't know how to handle the Internal principles of the PHP development team. Use [] square brackets instead of {} braces.
Large braces! Big! Brackets, the data structure of PHP is mixed, braces, and the biggest brackets. Haha, everything can be covered ,, braces {}. The symbolic image also meets the visual requirements.
Reply content:
Php used to only use array = (). In the new version, square brackets []... are used in the phrase method. Isn't the braces {} better suited to the general public?
C # int [] array = {1, 2, 3, 4, 5, 6 };
Java int [] arr = {0, 0, 0, 0, 0, 0, 0, 0 ,};
The Dictionary of the python () tuples [] list/Array {} is not mixed into one. python is related to php. []
Golang arr: = [...] int {1, 1, 1, 1, 1, 1}
All braces {} contain ,,,
Php uses [] brackets. Is it because {} braces have some special uses in php $ a = "aaaaaa {$ B} aaaaaa"? Are you afraid of ambiguity ?, Otherwise, it is more convenient to press [] brackets than bridge {} braces. shift is not required.
Guess it !!! I just don't know how to handle the Internal principles of the PHP development team. Use [] square brackets instead of {} braces.
Large braces! Big! Brackets, the data structure of PHP is mixed, braces, and the biggest brackets. Haha, everything can be covered ,, braces {}. The symbolic image also meets the visual requirements.
It's strange to use braces. In the mathematical context, {} represents a set, [] represents a list, and the set is ordered without order. Therefore, more and more modern languages use [] to represent the list.
Add @ yetone:
The array representation of PHP has been array () for many years, and the [] method was introduced in PHP5.4. If you have been writing PHP for a while, you will find that using [] to represent arrays is also something you really want in your heart. This is a natural thing.
Also, it's too hard to write array (), okay?
PHP arrays are not traditional C arrays, but map, linked list, heap, stack ......
You can use the short array definition syntax from 5.4 and replace array () ().
The programming languages generally use [] to represent arrays or queues, and {} to represent dictionaries or collections.
In php, Arrays can represent dictionaries because they are key-value pairs. So the subject thought of using {}.
The latest PHP5.4 + version is supported, but few users use it. Most of them are PHP 5.2 and php5.3.3.
[] Supported in PHP5.4, and not all language-defined arrays use {}, such as JS
Php arrays are actually dictionaries, so we cannot compare arrays in other languages.
The py dictionary is {}
Js object is {}
The swift dictionary is [:]
It seems that new languages tend to use brackets.
Php5.4 is newer, so brackets are used.