php - Merge 2 arrays into 1 multidimensional array by index -


been racking brain few hours trying merge these 2 arrays 1 multidimensional array.

here data, output want , i've tried.

array 1:  array (size=67) 0 => string '1/10/2015' (length=9) 1 => string '1/12/2015' (length=9) 2 => string '1/17/2015' (length=9) 3 => string '1/19/2015' (length=9) 4 => string '1/21/2015' (length=9)  array 2:  array (size=67) 0 => int 3 1 => int 3 2 => int 3 3 => int 1 4 => int 4 

desired multidimensional array:

array (size=67) 0 =>    array (size=1)    0 => int 3    1 => string '1/10/2015'  1 =>  array (size=1)   0 => int 3   1 => string '1/12/2015'  2 =>   array (size=1)   0 => int 3   1 => string '1/17/2015' 3 =>   array (size=1)   0 => int 1   1 => string '1/19/2015' 4 =>   array (size=1)   0 => int 4   1 => string '1/21/2015' 

here tried:

$dailytotal = array_merge($arr1,$arr2);  $dailytotal = array_merge_recursive($arr1,$arr2);  $dailytotal = array_combine($arr1,$arr2); 

and 4 other different functions... can please put me in right direction. head explode. thanks

as simple as:

array_map(null, $array2, $array1) 

see http://php.net/array_map, example null callback.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -