Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/10/2014, 14:51
Myl
 
Fecha de Ingreso: agosto-2011
Mensajes: 61
Antigüedad: 15 años, 1 mes
Puntos: 3
Agrupar campos de un array

Hola,

Si por ejemplo, tengo este arreglo simple:

Código PHP:
$arrDatos[0] = array("nombre" => "test1", "id" => 2);
$arrDatos[1] = array("nombre" => "test2", "id" => 2);
$arrDatos[2] = array("nombre" => "test3", "id" => 3);
$arrDatos[3] = array("nombre" => "test4", "id" => 3);
$arrDatos[4] = array("nombre" => "test5", "id" => 4);
$arrDatos[5] = array("nombre" => "test6", "id" => 5); 
Como puedo hacer que al recorrerlo con foreach...
Código PHP:
foreach ($arrDatos as $index => $value){

} 
Se muestren así:

2
test1
test2
3
test3
test4
4
test5
5
test6

Agradecería me puedan ayudar.