The behavior of unparenthesized expressions containing both ‘.’ and ‘>>’/’<<’ will change in PHP 8: ‘<<’/’>>’ will take a higher precedence¶
Description¶
<<
/>>
and .
operators used to have the same priority. This meant that expressions which mixed them would see them executed from left to right. This was confusing, so PHP 8.0 has made the addition the highest priority, closer to human way of reading the code.
Example¶
<?php
$b = 16;
$a = 'a '. $b << 1;
?>
Solutions¶
Add parenthesis to make the code less ambiguous.