The + operator in PHP is used for ______.

  • Addition
  • Subtraction
  • Multiplication
  • Division
The + operator in PHP is used for addition. It can be used to add two numbers or concatenate two strings. When used with numbers, it performs mathematical addition, while with strings, it concatenates them. For example, $sum = $num1 + $num2; will add the values of $num1 and $num2 and store the result in $sum. Similarly, $fullName = $firstName + $lastName; will concatenate the values of $firstName and $lastName to form a full name. Learn more: https://www.php.net/manual/en/language.operators.arithmetic.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *