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
Loading...
Related Quiz
- You are writing a PHP script and you have an array. You want to execute a block of code for each element in the array. How would you do this using a foreach loop?
- How do you connect to a MySQL database in PHP?
- Is it possible to use COM components in PHP?
- What are some common uses of the fclose() function in PHP?
- What is the concept of autoloading in PHP? How does it work and how can you implement it in your code?