PHP join 2 arrays -


i have 2 arrays

$array1 = array(     ['2013-05-01']=>'test',     ['2013-05-02']=>'testing',     ['2013-05-03']=>'working',     ['2013-05-04']=>'future test');  $array2 = array(     ['2013-05-01']=>'1',     ['2013-05-02']=>'done',     ['2013-05-03']=>'code',     ['2013-05-05']=>'release'); 

i want join these array, output is

$result = array(         ['2013-05-01']=>'test 1',          ['2013-05-02']=>'testing 2',         ['2013-05-03']=>'working code',         ['2013-05-04']=>'future test',         ['2013-05-05']=>'release') 

i tried $result = $array1 + array2; array_merge() , array_combine() none gave correct result.

can me please.

foreach($array2 $key => $value) {     $array1[$key] = isset($array1[$key]) ? $array1[$key] . " " . $value : $value; } 

Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -