Php arithmetic operators

Source: Internet
Author: User
The operands of the modulo operator are converted to integers (excluding decimal digits) before the operation ). The result of the modulo operator % is the same as that of the divisor (plus or minus sign. That is, do you still remember the basic mathematical knowledge learned in school in the result of $ a % $ B and $? Just like them.

Arithmetic operators

Example name result

-$ A: returns the negative value of $.

$ A + $ B addition: sum of $ a and $ B.

The difference between $ a-$ B subtraction $ a and $ B.

The product of $ a * $ B multiplication $ a and $ B.

$ A/$ B Division $ a divided by the operator of $ B.

$ A % $ B modulo $ a divided by the remainder of $ B.

The division operator always returns a floating point number. Only in the following cases: both operands are integers (or integers converted into strings) and can be fully divided. in this case, an integer is returned.

The operands of the modulo operator are converted to integers (excluding decimal digits) before the operation ).

The result of the modulo operator % is the same as that of the divisor (plus or minus sign. That is, the result of $ a % $ B is the same as that of $. For example:

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.