2350 | | $old_item_data = $groups[ $group_id ]['items'][ $item_id ]; |
2351 | | $merged_item_data = array_merge( $export_datum['data'], $old_item_data ); |
| 2350 | $merged_item_data = $groups[ $group_id ]['items'][ $item_id ]; |
| 2351 | //append the new data, but don't overwrite the data that has already been collected |
| 2352 | foreach ( $export_datum['data'] as $new_key => $new_value ) { |
| 2353 | if ( is_int( $new_key ) ) { |
| 2354 | //append numeric indices, similar to the array_merge functionality |
| 2355 | $merged_item_data[] = $new_value; |
| 2356 | continue; |
| 2357 | } |
| 2358 | |
| 2359 | if ( array_key_exists( $new_key, $merged_item_data ) ) { |
| 2360 | //avoid overwriting the existing higher priority data with lower priority |
| 2361 | continue; |
| 2362 | } |
| 2363 | |
| 2364 | $merged_item_data[ $new_key ] = $new_value; |
| 2365 | } |
| 2366 | |