How to explain this assignment principle of php two-dimensional array?

when reading other people"s code in the material, I found a way to assign values to php two-dimensional arrays. Here is a simple example

$call["a"][]="1";
$call["a"][]="2";

the result of this assignment is

array (size=1)
  "a" => 
    array (size=2)
      0 => string "1" (length=1)
      1 => string "2" (length=1)

I want to know what the principle is.

Php
May.13,2021

read more documents

clipboard.png


this has nothing to do with two-dimensional arrays, which can be written as $arr [] = 'specific value', which can be understood as a process of stacking, and the subscript will be added in the order of 0, 1, 2, etc. (if it is originally a non-associative subscript)


this has nothing to do with the principle, right? Array basic assignment. It is generally used to append elements through the body of the loop.

Menu