What are some common pitfalls when performing arithmetic operations in PHP?

One common pitfall when performing arithmetic operations in PHP is the use of incorrect data types. For example, trying to perform arithmetic operations on strings instead of integers can lead to unexpected results. To avoid this issue, always make sure to use the correct data types when performing arithmetic operations in PHP.

// Incorrect data type example
$num1 = "10";
$num2 = 5;
$result = $num1 + $num2; // This will concatenate the strings instead of adding them

// Correct data type example
$num1 = 10;
$num2 = 5;
$result = $num1 + $num2; // This will correctly add the integers