This isn't really a critique thred, but I didn't know where to put it.
When I write code I always build in debug modes into the code to make development time decrease. The way I do it is very simple:
define('DEBUG', true); // if this var is true, numerous debug statements will be printed out in the
// course of the execution of this script
function dbg($string="DEBUG STATEMENT")
{/*******************************************\
* This function prints a string $string if
* the constant DEBUG is set to true
\*******************************************/
if(DEBUG)
{
print("<div id=\"".rand(0,2147483648)."\"><p>" . $string . "</p></div>\r\n");
}
}
Every time I query a databse, or do some loops, I put a dbg call afterwards to know exactly when my code breaks, and whenyou are done developing you can just set one variable to false and all the debug statements go away.
You could go without the div and paragraph tag, but I put it in there to be compliant with my site's requirements.
I was also wondering if anybody else did something like this or if I was just wierd.