Okay, so I'm in the midst of creating a PHP framework, a project which started out as a simple template system I've now been working on for a year and a half to two years due to a couple computer crashes and ideas for new features and implementations for those features by that annoying kid in my head

. Anyways, point being, I want to be able to produce debug messages without manually adding:
Code: Select all
if($_GET['debug']==1) echo "Dbg: Some debug message here...";
to each and every function I want to debug.
Is there a function in PHP that allows you to do that everytime I call a function within a certain class? I know about magic methods (like __call), but that's not exactly what I want being that it's only executed when the function does not exist.
Any help would be appreciated, thanks

.