What is the result of the loose comparison `0 == ‘foobar’` in PHP?

PHP Intermediate Hard

PHP Intermediate — Hard

What is the result of the loose comparison `0 == ‘foobar’` in PHP?

Key points

  • Loose comparison triggers type juggling
  • Non-numeric strings convert to 0 when compared to integers
  • Strict comparison (===) avoids this behavior

Ready to go further?

Related questions