[plug] [OT] PHP Global DEBUG varible constant

Tim White weirdo at tigris.org
Mon Aug 2 05:08:39 WST 2004


Not sure what to put as the title.
I am writing a PHP application which I wish to put debugging in. I 
currently have a constant called 'DEBUG' that holds the debugging level. 
I would like to be able to have a varible named 'DEBUG' or '$DEBUG' that 
I don't have to worry about declaring as global at the start of every 
function.
i.e.

<?php  
    $DEBUG = 2;

    function capture_talk(){
       global $DEBUG; // This is the line I wish to be able to forget
       if ($DEBUG) print "Debug is on<br>";
       if ($DEBUG >=2) print "Debug is on level 2<br>";
etc..

Thanks
Tim



More information about the plug mailing list