I'm trying to understand arrays better. Pardon my elementary questions as I just opened my first php book three weeks ago.
I get that you can retrieve key/value pairs using a foreach (or for loop) as below.
 $stockprices= array("Google"=>"800", "Apple"=>"400", "Microsoft"=>"4",  "RIM"=>"15",  "Facebook"=>"30");
foreach ($stockprices as $key =>$price)
What I get confused about are multi dimensional arrays like this one:
$states=(array([0]=>array("capital"=> "Sacramento", "joined_union"=>1850, "population_rank"=> 1),
              [1]=>array("capital"=> "Austin", "joined_union"=>1845,"population_rank"=> 2),
              [2]=>array("capital"=> "Boston", "joined_union"=>1788,"population_rank"=> 14)
              ));
My first question is really basic: I know that "capital', "joined_union", "population_rank" are keys and "Sacramento", "1850", "1" are values (correct?). But what do you call [0][1][2]? Are they "main keys" and "capital" etc. sub-keys? I can't find any definition for those; neither in books nor online.
The main question is how do I retrieve Arrays [0][1][2]? Say I want to get the array that joined_union in 1845 (or even trickier during the 1800s), then remove that array.
Finally, can I name Arrays [0][1][2] as California, Texas and Massachusetts correspondingly?
$states=(array("California"=>array("capital"=> "Sacramento", "joined_union"=>1850, "population_rank"=> 1),
              "Texas"=>array("capital"=> "Austin", "joined_union"=>1845,"population_rank"=> 2),
              "Massachusetts"=>array("capital"=> "Boston", "joined_union"=>1788,"population_rank"=> 14)
              ));
 
     
     
     
    