merging-data
Merge two numerically-keyed associative arrays and preserve the original keys
Just use: $output = array_merge($array1, $array2); That should solve it. Because you use string keys if one key occurs more than one time (like ’44’ in your example) one key will overwrite preceding ones with the same name. Because in your case they both have the same value anyway it doesn’t matter and it will … Read more
Merging two arrays with the “+” (array union operator) How does it work?
Quoting from the PHP Manual on Language Operators The + operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored. So if you do $array1 = [‘one’, ‘two’, … Read more