Is it possible to do something like this one:
class conditional
{
function __construct()
{
if (launch() is called) {
//return True
//function is called by class instance
}else{
//return False
//launch() is not called
}
}
public function launch(){
echo "function is launcher";
}
}
I am trying to use a condition in class constructor to know if the class function is called by class instance or object as $class_instance->launch(). If the function is not called by class instance then it should run return else condition.
$class_instance->launch()doesn't trigger$class_instance::__constructmethod as you expect in the code above