There is an N-dimensional array of elements with unique keys of non -arrays of elements. It is necessary to convert it to one-dimensional. The question is perhaps elementary, but I don’t see a suitable function from the standard ones: http://www.php.net/manual/ru/ref.array.php
For example, array_merge_recursive()
preserves the nested structure of the original array, array_map()
and some others require a callback
function, it seems to me that this is not a beautiful solution, since anyway, no conversion is needed on the values of the elements.
appendarray(a,b)
- adds the arrayb
to the end ofa
.append(a,b)
- adds the value ofb
to the end ofa
.(x is array)
- all the instructions that check the type of element in php is, you just need to find the name. - KoVadim$output[$key] = x($val)
, you insert the array as one element. And you need to add element by element. In my pseudocode, there is append and appendarray. - KoVadim