In PHP, is:
$objectVar = someClassName::someFunction($var);
the same as:
$object =开发者_如何学JAVA new someClassName();
$objectVar = $object->someFunction($var);
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.
精彩评论