Addition¶
PHP additions apply to two different types : numbers and arrays.
For numbers, aka integers or float, this is the classic mathematical addition.
For arrays, this is a special version of array merge : the arrays are merged, and keys are kept once they are written. This features only exists for addition and arrays. Substraction is not available.
<?php
$a = 1 + 2.3; // 3.3
$b = [1] + [3, 4]; // [1, 4]
?>
See also Array operators, Combining arrays using + versus array_merge in PHP
Related : Array, integer, Floating Point Numbers