What are potential pitfalls when using floats in PHP for calculations?

When using floats in PHP for calculations, potential pitfalls include issues with precision and rounding errors due to the way floating-point numbers are represented in computers. To avoid these pitfalls, it is recommended to use the PHP `bcmath` extension, which provides arbitrary precision arithmetic functions for working with numbers with higher precision.

// Using the bcmath extension for precise calculations
$number1 = '1.1';
$number2 = '2.2';

$result = bcadd($number1, $number2, 2); // Add two numbers with 2 decimal places precision

echo $result; // Output: 3.3