Home  >  Article  >  Backend Development  >  Comparison between PHP operators and operators in other languages

Comparison between PHP operators and operators in other languages

巴扎黑
巴扎黑Original
2017-08-07 10:31:551368browse

The ‘- >’ symbol is the “infix dereference operator”.

In other words, it is a method of calling a subroutine that passes parameters by reference (of course, there are other functions).

As we mentioned above, when calling PHP functions, most parameters are passed by reference.

The '->' functions in PHP are the same as they are in Perl or C++. The following is a simple dereference example:

Echo $x->def(); # Output

The '=>' operator is very common in PHP scripts. Because PHP array functions are rich, we often use arrays because they are very convenient for manipulating data.
 $phparr= new array( in => 'reply,'
side => 'left',padx => 2m,pady => 2m,ipadx => 2m,ipady => 1m)

By the way, if you need to use a numerical "greater than or equal to" symbol, you should use ">=" instead of "=>".

In PHP, "::" is called the range parsing operator, also known as the domain operator

The "::" symbol can be considered It is similar to "." in C language, and it is more like the :: class range operator in C++ (Perl).

#Qp Call the internal static members of the class, or call between classes::

This is an example:

   class A
   {
       static $count = 0;
        static function haha()
       {
           //
        }  
       function diaoyoug()
     {
          self::haha();
        self::$count;
       }
   }
  a.b.c; /* C语言中的 */
  a::b::c(); // C++ 中的函数
  $a::b::c; # Perl 5中的标量

The above is the detailed content of Comparison between PHP operators and operators in other languages. 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