Dot And Plus Changed Precedence

The dot (concatenation) and addition + operators have a distinct priority in PHP 8.0. In particular, + has now precedence.

PHP code

<?php

echo 3 . 4 + 5;

?>

Before

PHP Deprecated:  The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /codes/dotAndPlus.php on line 3

Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /codes/dotAndPlus.php on line 3
39

After

39

PHP version change

This behavior was deprecated in 7.4

This behavior changed in 8.0

See Also

Error Messages