February 2013
Intermediate to advanced
538 pages
20h 55m
English
The values in an array can themselves be arrays. This lets you easily create multidimensional arrays:
$row0=array(1,2,3);$row1=array(4,5,6);$row2=array(7,8,9);$multi=array($row0,$row1,$row2);
You can refer to elements of multidimensional arrays by
appending more []s:
$value = $multi[2][0]; // row 2, column 0. $value = 7
To interpolate a lookup of a multidimensional array, you must enclose the entire array lookup in curly braces:
echo("The value at row 2, column 0 is {$multi[2][0]}\n");Failing to use the curly braces results in output like this:
The value at row 2, column 0 is Array[0]Read now
Unlock full access