What is the result of the following loose comparison?var_dump(0 == ‘abc’);

PHP Intermediate Hard

PHP Intermediate — Hard

What is the result of the following loose comparison?var_dump(0 == ‘abc’);

Key points

  • Non-numeric strings convert to 0 in numeric contexts
  • Loose comparison triggers implicit type conversion
  • Always prefer strict comparison (===) to avoid this behavior

Ready to go further?

Related questions