This question already has an answer here:
So I'd like to be able to switch a certain function on or off depending on if a variable is true or false. The function would still execute, but because the variable is false, it won't do it's routine.
Something like this
$testTF = "T";
function Test($test=$testTF){
echo $test;
}
Test("Go");
Of course this won't work, but I'm wondering if there's a way to make it work like intended. This function is sprinkled everywhere in the script, and needs to be in certain places, so I can't just group them all together under one if statement because it would break them.
I know you could just pass the value as a flag every time you call it, but I'm looking for a way to make it assume that value as default unless told otherwise. Maybe I'm looking at globals here but that's dangerous I'm told.
Thanks
</div>