PHP function : smart_array_merge