Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence
29

After

3-1

PHP version change

This behavior was deprecated in 7.4.

This behavior changed in 8.0.

See Also

Error Messages

Extension

Analyzer

© 2023-2026, Damien Seguy - Exakat