2
I have a two-dimensional array (it contains data from the database). To go through this data, I use a foreach(). I need to add an index and a value to that index at the end of each foreach iteration().
Imagining as if it were an array (row x column), I need to insert a column at the end of each row. Follow the code below:
foreach($dados as $d) {
if($d['direta'] == 1 && ($d['idEntidade_evento'] == 0 && $d['idSemana'] == 0)){
$d['tipo'] =& 'Mensagem instantânea';
} else if($d['direta'] && $d['idEntidade_evento'] > 0 && $d['idSemana'] == 0){
$d['tipo'] =& 'Evento';
} else{
$d['tipo'] =& 'Avaliação';
}
}
At the end, I need $data to contain everything (the new index entered in the foreach() )
At the end, $data does not have this index (there is no $data['type']). It is as if nothing is inserted.
I updated the post.
– Leonardo Santos