Let me take a look at PHP3 's arithmetic, string, logic, and comparison operators, respectively.
1. Arithmetic operators
+: $a + $b plus $a plus $b-: $a-$b minus $b *: $a * $a multiplied by $b times $b/: $a/$a except $b divided by $b%: $a% $a modulo $b divided by the remainder of $b if two Count is an integer value (the string is converted to an integer value) and division ("/") returns an integer value (the value of the divide). If either operand is a floating-point value, floating-point division is done.
2 string operators
The string operator has only a string connector ("."). $a = "Hello"; $b = $a. "World!"; Now $b = "Hello world!"
3, assignment operator
The basic assignment operator is "=". The value of an assignment expression is the value assigned to it. For example, the value of an expression $a = 3 is 3. This allows you to do something complicated: $a = ($b = 4) + 5; Now $a equals 9, $b is 4. In addition to the basic assignment, there are "composite operators." For all binary numbers and strings, allow you to do variable self recombination operations.
For example: =: $a = 3; + +: $a + 5; Set the $a to 8, namely: $a = $a + 5; $b = "Hello"; . : $b. = "there!"; Set $b to "Hello there!", like $b = $b. "There!";
4, bitwise operator
Bitwise operations allow you to place or reset the specified data. And: With operations, $a & $b with $a and $b are set to result in bit |: or operations, $a | $b or $a or $b has a set bit of the result is placed ~: Non-operation, ~ $a non-$a is not placed in the result is placed
5. Logical operators
And: $a and $b are true either with $a and $b true or: $a or $b or $a or $b have a true result for true XOR: True if $a xor $b different or $a and $b is true! : ! $a non-$a false results are true &&: $a && $b and $a and $b are true the results are true | | $b or $a or $b if one is true the result compares two variables, "There are two operators for the and or operations this is to assume that two operators have different precedence 6, compare operator comparison operators, and, like names, allow you to compare two values. = =: $a = = $b equals $a equals $b result is true!=: $a!= $b not equal to $a $b result is true <: $a < $b less than $a less than $ result is true >: $a > $b greater than $a greater than $b result True <=: $a <= $b less than or equal to $a less than or equal to $b result is true >=: $a >= $b greater than or equal to $a greater than or equal to $b result is true
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.