PHP Arrays (Cont.)
Associative Arrays (Cont.)
If the ID key of an associative array is a string, it could be doubly quoted or singly quoted.
†According to the Stack Overflow, using array key names without quotes is a legacy feature in PHP.
It was originally the way to do it, but it is no longer recommended and is only still supported for backward compatibility.
Multidimensional Arrays
In a multidimensional array, each element in the main array can also be an array.
And each element in the sub-array can be an array, and so on.
The arrays could be associative arrays too.
It seems variable interpolation does not work for a multidimensional array element.
For example,
echo "$families[$arr2][$i]<br />";
is not working.
You have to use the following command instead:
echo $families[$arr2][$i] . "<br />";
What did the baby corn ask the mama corn?
“Where’s Pop corn?”
|