Overview of categories of PHP operators_PHP Tutorial

WBOY
Release: 2016-07-15 13:29:58
Original
965 people have browsed it

PHP operators 1. Arithmetic operators

PHP arithmetic operators include + (addition), - (subtraction), * (multiplication) ), / (division), % (remainder).

PHP operators 2. Assignment operators

PHP assignment operators include += (add the value on the left plus the value on the right and assign it to the left), -= (The value on the left minus the value on the right is assigned to the left), *= (The value on the left is multiplied by the value on the right and assigned to the left), /= (The value on the left is divided by the value on the right and assigned to the left), % = (Assign the remainder of the value on the left to the value on the right to the left), .= (Connect the string on the left to the right and assign it to the left).

PHP Operator 3. String Operator

The PHP string operator only has the connection symbol ".", which connects two strings.

PHP operators 4. Increment and decrement operators

PHP increment and decrement operators have four forms: $a++; ++$a; $ a--; --$a.

PHP operators 5. Logical operators

PHP logical operators include! (logical NOT), and (logical AND), && (logical AND), or (logical OR, as long as one of the two expressions is true, the result is true), || (logical OR), xor (XOR, if only one of the two expressions is true, the result is true).

and || have higher priority than and and or.

PHP Operators 6. Bit Operators

Bit operators convert all numbers into binary numbers for calculation.

Bitwise operators include & (bitwise AND), | (bitwise OR), ^ (bitwise XOR), << (bitwise left shift), >> (bitwise Right shift), ~ (bitwise negation).

PHP Operator 7. Relational Operators

Relational operators include == (equal), != (not equal), < (less than), > ; (greater than), <= (less than or equal to), >= (greater than or equal to).

PHP operator 8. Other operators

PHP operator There are also some operators, such as $ (variable symbol), & (variable pointer, take address) , @ (added before the function, no error message is displayed), ?: (ternary operator),, (comma operator), -> (object methods and properties), => (array assignment).

PHP operators 9. Operator priority

PHP operators have priorities. When multiple operators are combined, the one with the highest priority is calculated first. The simple understanding is to multiply and divide first and then add and subtract, so I won’t go into details here.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446323.htmlTechArticlePHP operators 1. Arithmetic operators PHP arithmetic operators include + (addition), - (subtraction), * (Multiplication), / (division), % (remainder). PHP operator 2. Assignment operator PHP assignment operator has += (add the value on the left to the right...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!