PHP arithmetic operators, php arithmetic operators _ PHP Tutorial

Source: Internet
Author: User
PHP and php arithmetic operators. PHP arithmetic operators, php arithmetic operator PHP arithmetic operator name description instance result x + y plus x and y and 2 + 24x-y minus x and y difference 5-23x * y multiply x and PHP arithmetic operator, php arithmetic operators

PHP arithmetic operators

Operator Name Description Instance Result
X + y Add Sum of x and y 2 + 2 4
X-y Subtraction Difference between x and y 5-2 3
X * y Multiplication Product of x and y 5*2 10
X/y Division Vendors of x and y 15/5 3
X % y Modulo (remainder of division) X divided by the remainder of y 5% 2
10% 8
10% 2
1
2
0
-X Invert X inversion -2
A. B Collocated Connect two strings "Hi". "Ha" HiHa

The following example demonstrates different results obtained using different arithmetic operators:

 

Run

Related reading:

Php strstr checks whether a string exists in the same string.

The php stristr () function finds the first occurrence of a string in another string.

The php strchr () function finds the first appearance of a string in another string.

Usage of strncasecmp, a comparison function between two php strings

Php strcasecmp compares two strings to determine if they are equal (compares the size of the two strings)

Http://www.bkjia.com/PHPjc/1129455.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1129455.htmlTechArticlePHP arithmetic operator, php arithmetic operator PHP arithmetic operator name description instance result x + y plus x and y and 2 + 2 4 x-y minus x and y difference 5-2 3 x * y multiply by x and...

Related Article

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.