I have two arrays:
A = [1, 2, 3, 4]
B = ['a', 'b', 'c', 'd']
I want to merge them into tuples (A, B) in an one-dimensional array:
C = [1, 'a', 2, 'b', 3, 'c', 4, 'd']
Is there some native function in PHP that lets you interpolate two arrays this way? If not, would a loop be the most effective and eficient way to do this?
The number of elements of A will always be the same of B.
Note: If it helps, in the context of my specific needs, array A can be summarized as a single 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']