1
I cannot print my array when I put a different key, it gives the error Warning: Invalid argument supplied for foreach(), how to proceed?
for ($i=0; $i < 2; $i++) {
$use[$i]['outrachave'] = 'some valor';
for ($j=0; $j < 2 ; $j++) {
for ($k=0; $k < 2 ; $k++) {
$use[$i][$j][$k]= 'z';
}
}
}
foreach ($use as $key) {
echo "<br/>";
foreach ($key as $a) {
echo('<br>');
foreach ($a as $b) {
print_r($b);
echo('<br>');
}
}
}
What are you trying to do anyway? Why so much
for
andforeach
?– NoobSaibot
I am making a user table with a User array that has several keys So $user['id_usuario']['name'] $user['id_user']['cargo'] $user['id_user']['relacao']['rated']] $usuario['id_usuario']['relacao']['avaliou'] $usuario['id_usuario']['relacao']['avalio']
– Felipe Dias