Dot And Minus Changed Precedence

The dot (concatenation) and substraction - 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/dotAndMinus.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/dotAndMinus.php on line 3
29

After

3-1

PHP version change

This behavior was deprecated in 7.4

This behavior changed in 8.0

See Also

Error Messages