Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What operators does PHP have?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what operators PHP has. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1. Arithmetic operator

The PHP arithmetic operators are + (plus),-(minus), * (multiplication), / (division), and% (remainder).

two。 Assignment operator

The PHP assignment operators are + = (assign the value on the left plus the value on the right to the left),-= (assign the value on the left minus the value on the right to the left), * = (multiply the value on the left by the value on the right to assign to the left), / = (divide the value on the left by the value on the right to assign to the left),% = (assign the value on the left to the value on the right), . = (concatenate the string on the left to the right and assign a value to the left).

3. String operator

The PHP string operator has only the concatenation symbol ".", which concatenates two strings.

4. Self-increasing and self-subtracting operator

The PHP self-increment and self-subtraction operator comes in four forms: $aqure operator; + + $an operator; $a muri operator;-- $a.

5. Logical operator

The PHP logical operator has! (logic is not), and (logic and), & & (logic and), or (logic or, the result is true as long as one of the two expressions is true), | (logical OR), xor (XOR, the result is true if one of the two expressions is true).

& & and | | have a higher priority than and and or.

6. Bit operator

The bit operator is calculated by converting all numbers into binary numbers.

The bitwise operators are & (bitwise and), | (bitwise OR), ^ (bitwise XOR), (bitwise right shift), and ~ (bitwise inverse).

7. Relational operator

The relational operators are = (equal to),! = (not equal to), (greater than), and = (greater than or equal to).

8. Other operators

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

9. Operator precedence

PHP operators have precedence, and when multiple operators are together, the priority is calculated first. The simple understanding is to multiply and divide and then add and subtract, so I won't repeat it here.

This is the end of this article on "what operator does PHP have". I hope the above content can be of some help to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report