php - How to access a constant from within a class method -


i'm migrating php application procedural oop.
use debug constant activate errors , warnings output (in fact, have thee, every 1 makes output more verbose.
can't find way access constants within method.
constants defined before autoload in separate file.

in utility file have

define('debug', true); 

and inside given method tried

if(!defined('debug')) define('debug', false); 

but end debug=false.
doing wrong? i'm total noob oop, gentle please :-)

clarification

every class has own file.
in given script, first thing include utility file. utility file 1 defines debug , has _autoload function.

script_file.php  includes utility_file.php   defines debug   has _autoload function 

according this, should access debug (no prepending $) in code directly. including or requiring utility file in same file has function you're talking about? don't think oop problem


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -