I have 2 arrays
$arr1 = array(1,3);
$arr2 = array(2,4);
I want merge them to one array with structure:
$arr = array(1,2,3,4);
Has php functions for that or exist good solution?
UPD: i don’t need sort values, i want put elements from first array to odd positions, elements from second to even positions
You would have to
mergethem first, thensortthem:There is no built-in function to do what you are describing, assuming they are both the same length: