12

Possible Duplicate:
what is the “::” notation in php used for?

I noticed this code while modifying a friends code and noticed this piece of code: TestPages::LoadMenu();

what does :: mean in php?

A great answer would mean a lot.

Thanks!

Community
  • 1
  • 1
PinoyStackOverflower
  • 5,214
  • 18
  • 63
  • 126
  • 5
    Please go back and accept the best answers to your questions (i.e. click the big check mark to the left of the best answers). It will give you +2 rep for each one that you mark and generally improve the information on this site. It's the right thing to do. Do it. – FishBasketGordo Aug 05 '11 at 15:01
  • dublicate of http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php – RiaD Aug 05 '11 at 17:53

5 Answers5

21

It's the 'Scope Resolution Operator'.

The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.

http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php

Dogbert
  • 212,659
  • 41
  • 396
  • 397
10

In layman terms it is used to call static Methods of a Class.

In your example, LoadMenu() is a static function of the TestPages class.

This means that you do not have to create an instance of a TestPages to call LoadMenu()

jondavidjohn
  • 61,812
  • 21
  • 118
  • 158
5

It is used to access static methods of class, static variables and constants

Read more

RiaD
  • 46,822
  • 11
  • 79
  • 123
3

It means static class member access, in this case static method invocation.

vartec
  • 131,205
  • 36
  • 218
  • 244
1

It's used to access class methods / properties:

http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php

James
  • 13,092
  • 1
  • 17
  • 19
  • 1
    An important distinction to make to those that see this answer in the future, is that it is used to reference ***`static`*** members of a class, not an instantiated object's members. – jondavidjohn Aug 05 '11 at 17:48