When to call class method directly?
<?php
Class::method();
?>
When to call class method after object instatiated?
<?php
$object = new Class();
$object->method();
?>
What are the differences between both of them?
When to call class method directly?
<?php
Class::method();
?>
When to call class method after object instatiated?
<?php
$object = new Class();
$object->method();
?>
What are the differences between both of them?
::
scope resolution operator that is used for direct call static class methods without object
Class::method();
you can use class variables $this->...
in this method.
$object = new Class();
new
is create object of class and you can also use class variables from object
in simple way object is instance of class.