I was hoping that if I were to define constants in a separate namespace, like:\[code\]<?phpnamespace config\database\mysql;const HOST = 'localhost';const USER = 'testusr';const PASSWORD = 'testpwd';const NAME = 'testdb';?>\[/code\]That I would be able to use \[code\]__autoload\[/code\] to automatically include them:\[code\]<?phpfunction __autoload($className){ echo "Autoload: {$className}\n"; $class_file = str_replace('\\', '/', $className) . ".php"; if(file_exists($class_file)) { include $class_file; }}echo config\database\mysql\HOST;?>\[/code\]This, however, does not work. The \[code\]__autoload\[/code\] is not called for the constant as it is with classes, leaving me with a \[code\]Undefined constant\[/code\] error.Does anybody know a workaround? Something I am missing.
Some way that I can use to simulate the class \[code\]__autoload\[/code\] for constants?Thanks.
Some way that I can use to simulate the class \[code\]__autoload\[/code\] for constants?Thanks.