# What's the difference between :: (double colon) and -> (arrow) in PHP?

10/14 15:40

### 问题：

There are two distinct ways to access methods in PHP, but what's the difference?在 PHP 中有两种不同的方法来访问方法，但有什么区别呢？

\$response->setParameter('foo', 'bar');


and

sfConfig::set('foo', 'bar');


I'm assuming -> (dash with greater than sign or chevron) is used for functions for variables, and :: (double colons) is used for functions for classes.我假设-> （带有大于号或 V 形的破折号）用于变量函数，而:: :（双冒号）用于类函数。 Correct?正确的？

Is the => assignment operator only used to assign data within an array? =>赋值运算符是否仅用于在数组中分配数据？ Is this in contrast to the = assignment operator which is used to instantiate or modify a variable?这与用于实例化或修改变量的=赋值运算符形成对比吗？

0
0 收藏

0 评论
0 收藏
0