what is the difference between -> and ::

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shamkawai
Forum Newbie
Posts: 7
Joined: Mon Jan 10, 2011 4:09 pm

what is the difference between -> and ::

Post by shamkawai »

so, what is the difference between -> and :: ??
thanks
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: what is the difference between -> and ::

Post by social_experiment »

The -> operator lets you access the object's properties and methods.

Found this in a book about object-orientated programming.

Scope resolution operator (::)
The scope resolution operator has the following uses:
It gives access to overridden properties or methods of a parent class.
It is used to call the static methods and properties of a class.
It gives access to class constants.
It is the conventional way of referring to a class method or property in documentation.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply