Handling differences in arithmetic, bitwise, and concatenation operations
Arithmetic, bitwise, and concatenation operations are at the heart of any PHP application. In this section, you learn about hidden dangers that might arise in these simple operations following a PHP 8 migration. You must learn about the changes made in PHP 8 so that you can avoid a potential code break in your application. Because these operations are so ordinary, without this knowledge, you will be hard pressed to discover post-migration errors.
Let's first have a look at how PHP handles non-scalar data types in arithmetic and bitwise operations.
Handling non-scalar data types in arithmetic and bitwise operations
Historically, the PHP engine has been very forgiving about using mixed data types in an arithmetic or bitwise operation. We've already had a look at comparison operations that involve numeric, leading-numeric, and non-numeric strings and numbers. As you learned, when a non-strict...