1

I am new to PHP, and I am practicing with some online tutorials. I usually encounter the sign :: while going through books, online tutorial or blogs. Even if I check some PHP demo applications I see this operator. I tried to put this sign in Google, but I got unexpected results. I even tried to search it in other forums as well, but I didn't got the right answer. I usually call it a bubble colon, but what is its technical name?

hakre
  • 193,403
  • 52
  • 435
  • 836
ScoRpion
  • 11,364
  • 24
  • 66
  • 89

4 Answers4

6

:: is the scope resolution operator (you may sometimes find references to Paamayim Nekudotayim, hebrew for "double colon"). It is used to call static functions of a class, as in

class MyClass {
  public static function hi() {
    echo "hello, world";
  }
}
MyClass::hi();

For more details on classes and objects, refer to the official documentation.

Community
  • 1
  • 1
phihag
  • 278,196
  • 72
  • 453
  • 469
3

It has the exotic name "Paamayim Nekudotayim", but you may just call it Scope Resolution Operator.

Patrick Glandien
  • 7,791
  • 5
  • 41
  • 47
3

It's called scope resolution operator. More information in Scope Resolution Operator (::) (PHP manual).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
usoban
  • 5,428
  • 28
  • 42
1

A single one is called a colon, so you could search for "php double colon" and would find this:

http://php.net/manual/en/keyword.paamayim-nekudotayim.php

Scope Resolution Operator (::)

Sometimes it is useful to refer to functions and variables in base classes or to refer to functions in classes that have not yet any instances. The :: operator is being used for this.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272