I have two arrays:
A = [1, 2, 3, 4] B = ['a', 'b', 'c', 'd']
I want to combine them into tuples (A, B) in a one-dimensional array:
C = [1, 'a', 2, 'b', 3, 'c', 4, 'd']
Is there any native function in PHP that allows you to interpolate two arrays this way? If not, can the loop be the most efficient and effective way to do this?
The number of elements A will always be the same for B.
Note. If this helps, in the context of my specific needs, array A can be summed as one value (since the value will be the same for all values in B).
A = 1 B = ['a', 'b', 'c', 'd'] C = [1, 'a', 1, 'b', 1, 'c', 1, 'd']