Do these two PHP OOP syntaxes yield the same result? -
in php, is:
$objectvar = someclassname::somefunction($var);
the same as:
$object = new someclassname(); $objectvar = $object->somefunction($var);
no.
$objectvar = someclassname::somefunction($var);
here, somefunction
static method; i.e. belongs class, not object.
$object = new someclassname(); $objectvar = $object->somefunction($var);
in code, instance method should accessed through object.
the result same, handle used call method different.
Comments
Post a Comment