Ok, I admit the question is confusing but I don't know how to say it in another way. I have an array that looks like this:
array(3) {
[0]=>
array(1) {
[some_middle-level_id]=>
array(1) {
[some_low-level_id]=>
array(5) {
["entry1"]=>
string(...) "..."
["entry2"]=>
string(...) ""
...
}
}
}
[1]=>
array(1) {
[another_middle-level_id]=>
array(5) {
[another_low_level_id]=>
array(5) {
["entry1"]=>
string(...) "..."
["entry2"]=>
string(...) ""
...
}
}
}
[2]=>
array(1) {
[another_middle-level_id]=>
array(5) {
[another_low_level_id]=>
array(5) {
["entry1"]=>
string(...) "..."
["entry2"]=>
string(...) ""
...
}
[another_low_level_id]=>
array(5) {
["entry1"]=>
string(...) "..."
["entry2"]=>
string(...) ""
...
}
}
}
EDIT: The other array would look like this. Let's say there are 3 [low_level_id] in the first array then the other array would simply look like this:
array(3) { [0]=> string(3) "bla" [1]=> string(4) "blub" [2]=> string(6) "lalala"}
and another array that have as many entries as "low level id"-entries exist. In every "low level id"-entry which contains 5 entries at the moment I want to add a sixth entry - a string from the other array. But I don't know how to access it. Is there away to access it without using hundreds of loops?
Another EDIT: I could access the first entry with:
foreach($my_array as $key => $subkey){
foreach($subkey as $val){
$my_array[$key][key($subkey)][key($val)]['6th_entry']="a new string";
}
}
But that works only for the first new entry. I don't know how to access the others and how to add a loop for adding entries from the other array.