The recent need to use a two-dimensional array in PHP, a simple example to illustrate how the two arrays in PHP using <?php$a=array (' A ', ' B ', ' C '), $c =array (' A1 ', ' B1 ', ' C1 '); $b =array (' id ' = >18, ' count ' =>27, $a, $c); echo $b [' id ']; 18echo $b [' count ']; echo $b [0][0]; Aecho $b [0][1]; Becho $b [0][2]; Cecho $c [1][0]; A1echo $c [1][1]; B1echo $c [A]; C1?> Note the order of the one-dimensional values of the two arrays in the example above, $b an array with two elements in front of it, and an array starting from $ A. This time if you want to take the first element in a $ A array should be $b
[0][0] instead of $b[1][0] Speaking here again my previous mistakes, although more stupid, but also hope that some like me more novice php beginners warning, hehe ~ ~ Note The following is an example of the error I used to think if I defined is $a=array (' id ' =>18, ' count ' =78) Then echo $a the output value of [' ID '] should be equivalent to echo $a [0] later lost the command only to discover that this is not the case. It turns out that this is related to how the array is defined in the following way $a=array (' id ' =>18, ' count ' =78) should be used $a [' ID '] and if defined in the way $a=array (' 18 ', ' 78 ') should be used $a[0]
How to use a two-dimensional array in PHP