I am wondering is it possible to merge 2 arrays that look this:
$array1 = array("a","b","c");
$array2 = array('c'=>array("blah"=>"5", "moreblah"=>"5"));
$merge = array_merge($array1,$array2);
print_r($merge);
Running this will give me this output:
Array ( [0] => a [1] => b [2] => c [c] => Array ( [blah] => 5 [moreblah] => 5 ) )
But the output I want is something similar to this:
Array( [a]=>Array([blah]=>0, [moreblah]=>0), [b]=>Array([blah]=>0, [moreblah]=>0), [c]=>Array([blah]=>5, [moreblah]=>5))
So for the first array I want the values to become the keys and then blah and moreblah to be added and set as 0 if they are not present in array 2. Also for array 2 if there is a repeat such as c in the example array 2 would just overwrite the c index and create the output I wrote above.
Is this possible? If so can I do it with a built in method or would I have to use a for loop to try get it working?
Edit:As has been pointed out to be it is not possible. Can someone explain what type of function I would need to make to be able to get the output I would want?