How do I combine these two arrays into a single array say $array3
?
$array1 =[1,2,3];
$array2=['a'=>1,'b'=>2,'c'=>3];
How do I combine these two arrays into a single array say $array3
?
$array1 =[1,2,3];
$array2=['a'=>1,'b'=>2,'c'=>3];
Try this
$temp = array_slice(array_keys($array1), 0, count($array2));
$array3 = array_merge($array1, array_combine($temp, $array2));
I believe this is what you're asking.