Home >Backend Development >PHP Tutorial >What are the symbols for common operators in php?

What are the symbols for common operators in php?

下次还敢
下次还敢Original
2024-04-27 12:24:30663browse

Common operator symbols in PHP include: arithmetic operators ( , -, *, /, %) assignment operators (=, =, -=, *=, /=) comparison operators (= =, !=, >, <, >=, <=) Logical operators (&&, ||, !) Bit operators (&, |, ^, <<, >>) Other operators (., ::, ->)

What are the symbols for common operators in php?

Common operator symbols in PHP

Operators are used to perform operations and modify variables. Common operator symbols in PHP include:

Arithmetic operators

    • Addition
    • Subtraction
    • Multiplication
  • / Division
  • % Find I

Assignment operator

  • = Assignment
  • = Additive assignment
  • -= Subtractive assignment
  • *= Multiplication assignment
  • /= Division assignment

Comparison operator

    ##== Equal to
  • != Not equal to
  • Greater than
  • < Less than
  • = Greater than or equal to
  • <= Less than or equal to

Logical operator

    && AND operation
  • || Or operation
  • ! Not operation

Bitwise operator

    & Bitwise AND
  • | Bitwise OR
  • ^ Bitwise XOR
  • << Left shift
  • Right shift
##Other operators

. Hyphen (used to connect strings)
  • :: used to access static members within a class
  • -> ; Used to access members within an object
  • These operators can be combined to create more complex expressions. For example, the following expression uses the addition and remainder operators to calculate the remainder of a number divided by 3:
<code class="php">$remainder = $number % 3;</code>

The above is the detailed content of What are the symbols for common operators in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:What does += mean in phpNext article:What does += mean in php