PHP Should I use CONSTANTS or VARIABLES -


I would like to know how anyone should use continuously and when 1 should use a variable in PHP

  define ("haha", "very bad"); $ Haha = "very bad"; First I want to propose to not follow the advice using the constants for the configuration. This will make your code difficult to test against the test environment, plus it is very unconventional to implement the code where you have to edit the code for app configuration.  

You will use most of the time, it raises the question that when you should use constants, those points should come to my mind:

  • Use constants .
  • Use the constellation to express the meaning for the defined set of different values, where value is of no value as it does not really matter what the value of these constants will be: STATE_NEW , STATE_old , STATE_DELETED

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -