转: PHP的"::"、"->"和"=>"的区别

来自:http://blog.csdn.net/wgw335363240/article/details/20453379

1."::" 运算法

  该运算符是调用一个类中的静态成员的方法,如:

 class xxx{

  protected static $instance;

 self::$instance="111";

或者 $this::$instance = "222";

}

2."->"运算符

 该操作符是操作一个类中的成员变量的方法,可以是非static成员变量,如:

 class xxx{

  private $test;

 $this-test="111";

}

3."=>"运算符

 该预算付是数组的key和value映射时使用的运算符。

语法“index => values”,用逗号分开,定义了索引和值。

posted @ 2017-08-06 08:00  QinXiao.Shou  阅读(1070)  评论(0编辑  收藏  举报