<?php $m=[[1,2,3], [4,5,6,7,8], [7,8,9]]; print_r($m); echo $m[1][1]; //Imprime 5 (fila 1, columna 1) echo $m[1][3]; //Imprime 7 (fila 1, columna 3) echo "<hr>"; //recorrer array foreach($m as $c1=>$fila){ foreach($fila as $c2=>$v){ echo "($c1,$c2) $v "; } echo "<br>"; } echo "<hr>"; $ma=[["nombre"=>"Ana","mail"=>"p@p.com","ciudad"=>"BCN"], ["nombre"=>"Eva","mail"=>"e@p.com","ciudad"=>"BCN"], ["nombre"=>"Rosa","mail"=>"r@p.com","ciudad"=>"BCN"], ]; print_r($ma); echo $ma[1]['mail']; //El mail de Eva (fila 1, columna 'mail' echo "<hr>"; //recorrer array foreach($ma as $c1=>$fila){ foreach($fila as $c2=>$v){ echo "($c1,$c2) $v "; } echo "<br>"; } echo "<hr>"; $aa=["gerencia"=>["nombre"=>"Ana","mail"=>"p@p.com","ciudad"=>"BCN"], "administracion"=>["nombre"=>"Eva","mail"=>"e@p.com","ciudad"=>"BCN"], "fábrica"=>["nombre"=>"Rosa","mail"=>"r@p.com","ciudad"=>"BCN"], ]; print_r($aa); echo $aa['administracion']['mail']; //El mail de Eva (fila 'administracion', columna 'mail' echo "<hr>"; //recorrer array foreach($aa as $c1=>$fila){ foreach($fila as $c2=>$v){ echo "($c1,$c2) $v "; } echo "<br>"; } echo "<hr>"; $a = []; $n = 4; $cont = 1; for ($i = 0; $i < $n; $i++) { for ($j = 0; $j < $n; $j++) { $a[$i][$j] = $cont; $cont++; } } print_r($a); echo $a[2][1]; //¿Qué imprime esto? $usuarios = [["Nombre" => "Eva", "Aficiones" => ["Musica", "Cine"]], ["Nombre" => "Ana", "Aficiones" => ["Baile", "Cine"]], ["Nombre" => "Rosa", "Aficiones" => ["Deportivas" => ["Fútbol", "Tenis"], "Culturales" => ["Música", "Teatro"]]], ]; echo $usuarios[1]["Aficiones"][0]; //Baile echo $usuarios[2]["Aficiones"]["Culturales"][0]; //Música