You need to use array_merge_recursive
instead of array_merge
. Of course there can only be one key equal to 'c'
in the array, but the associated value will be an array containing both 3
and 4
.
More Related Contents:
- PHP: merge two arrays while keeping keys instead of reindexing?
- PHP – How to merge arrays inside array
- Merging two multidimensional arrays on specific key
- Prepend associative array elements to an associative array
- Array_merge versus + [duplicate]
- Insert elements from one array (one-at-a-time) after every second element of another array (un-even zippering)
- Array merge on key of two associative arrays in php?
- Combine two 2d arrays and have duplicate rows removed
- How to merge subarray values and remove duplicates?
- How to update multiple MySQL table entries with different id?
- What’s wrong with using $_REQUEST[]?
- “Keep Me Logged In” – the best approach
- PHP, How to catch a division by zero?
- In where shall I use isset() and !empty()
- Why is PDO better for escaping MySQL queries/querystrings than mysql_real_escape_string?
- What does this symbol mean in PHP
- Can’t install laravel installer via composer
- How to solve General error: 2006 MySQL server has gone away
- Long Polling/HTTP Streaming General Questions
- Algorithms for string similarities (better than Levenshtein, and similar_text)? Php, Js
- Using PHP as a template engine
- Short unique id in php
- mail(): SMTP server response: 550 The address is not valid error on hmailserver
- PHP move_uploaded_file() error?
- How to save memory when reading a file in Php?
- PHP is not recognized as an internal or external command in command prompt
- PHP authentication with multiple domains and subdomains
- Fatal error: Call to undefined method mysqli_stmt::get_result()
- Recreate original PHP array from print_r output [duplicate]
- Add a custom checkbox in WooCommerce checkout which value shows in admin edit order