What is the operator used for addition in PHP?

  • +
  • -
  • *
  • /
The + operator is used for addition in PHP. It can be used to add two numbers or concatenate two strings. 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 *