PHP array addition

Here is another PHP thing I need to think clearly about from time to time:

var_dump( [ 'a' => 1 ] + [ 'a' => 2, 'b' => 2 ] );

Returns:

array(2) {
  'a' =>
  int(1)
  'b' =>
  int(2)
}

Leave a Reply