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
  • 184,866
  • 48
  • 414
  • 792
ScoRpion
  • 11,186
  • 24
  • 64
  • 87

4 Answers4

5

:: 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
  • 263,143
  • 67
  • 432
  • 458
3

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

Patrick Glandien
  • 7,601
  • 5
  • 39
  • 47
3

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

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
usoban
  • 5,372
  • 26
  • 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
  • 139,522
  • 20
  • 204
  • 252