What is the output of the following code snippet? $a = ’10’; echo $a + 5;

PHP Intermediate Medium

PHP Intermediate — Medium

What is the output of the following code snippet? $a = ’10’; echo $a + 5;

Key points

  • Arithmetic operators trigger numeric type juggling
  • Strings starting with numeric characters are converted to integers or floats
  • Concatenation uses the dot operator, not the plus operator

Ready to go further?

Related questions