Is it possible to merge non-specified number of array elements in PHP?
I received data through JSON string (n elements), then I used them to do n loops - each loop saves the result to a different array cell ($result[1], $result[2], $result[3], ... ,$result[n]
). I would like to merge the results into a single array (I have to send single array through JSON). Everything works if I write manually array_merge ($result[1], $result[2], $result[3])
, but I never know how many variables I will receive.
Thanks in advance