Okay, you're doing a few things wrong.
First of all, you don't HAVE any numerical indexes defined in your inner arrays. You only have the string indexes "dodder", "drawings", and "garbage".
2nd of all, the fact that you're trying to access index 1 in an array that only contains one item implies that you believe PHP arrays are 1-indexed. They're not. The first automatically assigned numerical index in an array is 0.
The $pictures[2][1] should most likely be $pictures[2]['garbage'].
Lastly, you've enclosed $pictures[2][1] in a string. PHP performs variable substitution within double-quoted strings up to a point; it doesn't handle nested arrays.
What's happening is that PHP sees "$pictures[2]" and tries to substitute THAT value into the string, then prints out the "[1]" after it. Since $pictures[2] is an array, PHP just substitutes the string "Array" for it's value.
Since you're not echoing anything else, just drop the quotes:
echo $pictures[2]['garbage'];
If you need the quotes, use curly-brace syntax for nested arrays:
echo "The item is {$pictures[2]['garbage']}.";
For more info on string parsing, read the manual at:
http://www.php.net/types.string#lang....syntax.double
You should also make heavy use of the print_r() and/or var_dump() functions. They display the contents of your variables, including all key/value pairs in an array.
For example:
Code:
// using your $pictures from above:
echo "<pre>\n";
print_r($pictures);
echo "</pre>\n";
?>
would result in something like the following output:
Code:
Array:
(
[0] => Array:
(
[dodder] => "All from the Dodder"
)
[1] => Array:
(
[drawings] => "Drawings of Wildlife"
)
[2] => Array:
(
[garbage] => "Stuff and more stuff"
)
)
Hope this helps!
Take care,
Nik
http://www.bigaction.org/