What is the result of the expression (int) (0.1 + 0.7) * 10 in PHP?

PHP Intermediate Hard

PHP Intermediate — Hard

What is the result of the expression (int) (0.1 + 0.7) * 10 in PHP?

Key points

  • Floating-point arithmetic is imprecise due to binary representation.
  • Type casting to int performs truncation, not rounding.
  • Avoid direct equality comparisons with floats.

Ready to go further?

Related questions