Home > Article > Backend Development > Talk about the differences between PHP operators '::', '->' and '=>'
When I was learning PHP recently, I was a little confused about the three operators "::", "->" and "=>". I will record the learning details here. Let yourself have a stronger grasp.
1."::" Operator
This operator is a method of calling static members in a class, such as:
class xxx{ protected static $instance; self::$instance="111"; //或者 $this::$instance = "222"; }
2."->"Operator
This operator is a method to operate member variables in a class, which can be non-static members Variables, such as:
class xxx{ private $test; $this-test="111"; }
3."=>"operator
This budget is used when mapping the key and value of the array operator.
The syntax "index => values
", separated by commas, defines the index and value.
Related learning recommendations: PHP programming from entry to proficiency
The above is the detailed content of Talk about the differences between PHP operators '::', '->' and '=>'. For more information, please follow other related articles on the PHP Chinese website!