Comparison between PHP operators and operators in other languages

巴扎黑
Release: 2023-03-14 18:22:02
Original
1385 people have browsed it

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中的标量
Copy after login

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!

Related labels:
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