Is there any way in PHP to tell if a function is being run from inside or outside a particular class of object?
function getToDaChoppa() {
if( "we're inside the Choppa object" ) {
$foo = "We're inside";
} else {
$foo = "We're outside";
}
echo $foo;
}
class Choppa() {
public function getStatus() {
getToDaChoppa();
}
}
Running:
getToDaChoppa();
( new Choppa )->getStatus();
should echo:
We're Outside
We're Inside