Ι must add sth important…I made this question simple cause I thought it would suffice the solve the bigger problem…which is many inner arrays and many IDs to to attach respectively to each one of them.
The multi-dimensional array is held in this variable:
$output['form'])
and the IDs are held here:
$_POST['updateIDs']
I tried using a foreach loop within foreach loop and array_push but I could not do it.
Furthermore…I think that first I must attach the IDs in the inner arrays and then change the name of the corresponding key.
yes it could be an option…but the fact that the first array is 2-dimensional complicates things.
I have tried several things(loops etc) but I cannot make it work.
In many cases what happens is that the IDs of the second array attach themselves to the first inner array of the 2 dimensional array.
array_merge_recursive() only makes sense when a) you don’t use loops and b) if you can find some kind of mapping between the two arrays. Since we only know the structure of the first array, we don’t have enough info to tell if array_merge_recursive() is a valid option to begin with.