Solved
array_merge renumbered my keys and I lost the IDs
Asked by Priya Nair · 417 views · 2 replies
Priya Nair8 messages · 3 solutions
I am merging two maps keyed by user ID:
$a = [14 => 'Priya', 22 => 'Tomasz'];
$b = [31 => 'Hannah'];
print_r(array_merge($a, $b));
// [0 => 'Priya', 1 => 'Tomasz', 2 => 'Hannah']
The IDs are gone. Is there a flag for this or am I using the wrong function?