Difference: The "->" operator is a method for operating member variables in a class. It accesses functions or objects in the class as an instantiated object, for example "$runoob->getUrl(); "; and "=>" is the operator used when mapping the key and value of the array. The syntax "index=>values" can assign values to the keys.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
##“-> "Operator
This operator is a method to operate member variables in a class, which can be non-static member variables, such as:class xxx{ private $test; $this-test="111"; }
"=>"Operator
This operator is used when mapping the key and value of an array. The syntax "index => values", separated by commas, defines the index and value.
The difference between -> and => operators in PHP
In PHP, the => operator is usually used for arrays During operation, the general form is as follows:$arr = array(key=>value,key2=>value2);
$runoob->getUrl();
PHP Video Tutorial"
The above is the detailed content of What is the difference between -> and => operators in php. For more information, please follow other related articles on the PHP Chinese website!