php - variable or constant? -


Is there any advantage of using one on another?

  $ lang = isset $ _COOKIE ['lang'])? $ _COOKIE ['Lang']: 'N'; # Or defined ("LANG", isset ($ _COOKIE ['lang'])? $ _COOKIE ['lang']: 'n');  

Thanks

In this case, a more stable one is more appropriate. As you want to use the same value through your entire application, and you probably do not want to accidentally change it

Notice There are many features in programming languages ​​that allow you to implement an algorithm There is no need to use them, but they are meant to produce algorithms to get more readable, maintenance and less bugs. Continually is one of those features.


Comments