In the PHP manual it states that the Scope Resolution Operator(::) has the following purpose
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.
Now I just came across a tutorial that was using the double colon like this:
class A {
public function nice(){
echo "hi";
}
}
$A = new A;
A::nice();
and the output is actually
hi
But why does this not throw an error? The function nice
is not a static method, nor is one overriding the method. Is it bad practice to use the double colon like that?