Reputation: 940
In PHP, is:
$objectVar = someClassName::someFunction($var);
the same as:
$object = new someClassName();
$objectVar = $object->someFunction($var);
Upvotes: 0
Views: 75
Reputation: 2941
No.
$objectVar = someClassName::someFunction($var);
Here, someFunction
is a static method; i.e. it belongs to a class, not an object.
$object = new someClassName();
$objectVar = $object->someFunction($var);
In this code, it is an instance method that should be accessed through an object.
The result could be the same, but the handle used to call the method is different.
Upvotes: 1