In many languages the []
notation stands for an array.
Is the same as php's array_push(): it pushes an element in the variable that has []
at the end.
If the variable is null, you can consider the square brackets like a declaration of an array.
The same notation of push applies to Javascript, for example. When using it like $var[] = 'a';
what happens is the same as array_push() I was talking above. Just finds the next position in the array and adds there your value.
An array can be walked with for
, foreach
, while
, do while
and you can check it's contents with print_r() or var_dump() functions.