When defining constants in PHP, you can use both the const and define methods, so what's the difference between them?
1.const the definition of a class member variable , once defined, cannot be modified. Define is not available for definition of class member variables and can be used for global constants .
2.const can be used in a class, define cannot .
3.const cannot define constants in a conditional statement .
4.const can only accept static scalars, and define can take any expression.
5.const defines a constant case-sensitive, while define can specify case sensitivity by using the third argument (true for case insensitivity).
The 6.const takes a common constant name. Define can use expressions as constants.
7. Using const makes the code easy to read, and const itself is a language structure. and define is a function.
8. Const is much faster at compile time than define .
The difference between const define in PHP