I have seen function called from php classes with :: or ->.
eg:
$classinstance::function or $classinstance->function
whats the difference?
I have seen function called from php classes with :: or ->.
eg:
$classinstance::function or $classinstance->function
whats the difference?
The ::
syntax means that you are calling a static method. Whereas the ->
is non-static.
MyClass{
public function myFun(){
}
public static function myStaticFun(){
}
}
$obj = new MyClass();
// Notice how the two methods must be called using different syntax
$obj->myFun();
MyClass::myStaticFun();