Can someone explain how these line of code are working
class DemoStatic {
function normalFunction() {
echo "This is the normal function";
}
static function staticFunction() {
echo "This is the static function";
}
}
$classObj = new DemoStatic();
DemoStatic::normalFunction();
vs.$classObj->normalFunction();
and
DemoStatic::staticFunction();
vs.$classObj->staticFunction();
And the output is as below
This is the normal function
This is the normal function
This is the static function
This is the static function
Now I really don't understand that how come a normal function is accessible via ::
Operator and static function is called using the class object.
Can someone please explain?