Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/05/2016, 09:22
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 6 meses
Puntos: 6
Como adicionar elemento en arreglo asociativo

hola amigos tengo el el siguientes arreglos asociativos y necesito adicionarle un nuevo

array:2 [▼
0 => array:3 [▼
"id" => "15"
"name" => "6"
"role" => "3"
]
1 => array:3 [▼
"id" => "16"
"name" => "65"
"role" => "32"
]

]


y necesito que quede asi:
array:2 [▼
0 => array:3 [▼
"id" => "15"
"name" => "6"
"role" => "3"
"registro" => 100
]
1 => array:3 [▼
"id" => "16"
"name" => "65"
"role" => "32"
registro => 100
]

]


y lo estoy haciendo de esta manera:

Código PHP:
Ver original
  1. foreach($diff1 as $key => $item) {
  2.                  foreach ($item as $key => $value) {
  3.                                $item['registro'] = 100;
  4.               }
  5.         }