as far as i know, :: is using for calling static functions and base class functions in a subclass. and as far as i know, usually we have to create an instance of a class for using it out of the class.
class a
{
public function foo()
{
//
}
}
for using this class:
$instance = new a();
$instance->foo();
but its possible that we call the foo function without creating any instance and only using ::. for example the following code is written out of class and works well:
a::foo();
why does it work? and how?
::is the scope resolution operator.http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php
From PHP’s docs:
It is like
->, but has some special semantics.