I have to define a constants to use all over the entire project(i.e: single.php, category.php, my-template.php). Suppose I define a array constant to declare a list of browser name. i.e: array('firefox'=>'Mozilla Firefox','google_chrome'=>'Google Chrome'). Now this constant will be accessible within any php file in my project. I can do this in several ways. But what is the best practice?
I have to define a constants to use all over the entire project(i.e: single.php, category.php, my-template.php). Suppose I define a array constant to declare a list of browser name. i.e: array('firefox'=>'Mozilla Firefox','google_chrome'=>'Google Chrome'). Now this constant will be accessible within any php file in my project. I can do this in several ways. But what is the best practice?
Depends on what your project is. If you're developing a theme you would define them at the top of your theme's functions.php file, and if you were developing a plugin you would put them at the top of your main plugin file.