Tuesday, 8 May 2018

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

There are two distinct ways to access methods in PHP, but what's the difference?




$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. 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?

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...