Let's say I have a FooClass
with a bar()
method. Inside of the bar()
method, is there any way to tell if it's being called statically or not, so I can treat these two cases differently?
FooClass::bar();
$baz = new FooClass();
$baz->bar();
Let's say I have a FooClass
with a bar()
method. Inside of the bar()
method, is there any way to tell if it's being called statically or not, so I can treat these two cases differently?
FooClass::bar();
$baz = new FooClass();
$baz->bar();
class FooClass {
function bar() {
if ( isset( $this ) ) {
echo "not static";
}
else {
echo "static";
}
}
}
FooClass::bar();
$baz = new FooClass();
$baz->bar();