Define section:
Macros can be used instead of constant values, and can be used instead of expressions, even code snippets. (Macros are powerful, but error-prone, so their pros and cons are quite controversial.) )
The syntax for a macro is:
Macro value #define Macro name
As a recommendation and a common practice for a broad range of programmers, macro names often use all uppercase letters.
Advantages of using Macros:
1) make the code more concise and clear
Of course, it depends on you taking a proper name for the macro. In general, the name of a macro is more important to have a clear and intuitive meaning, sometimes it is better to make it longer.
2) Convenient Code maintenance
The processing of macros is referred to as "preprocessing" during compilation. In other words, before the formal compilation, the compiler must first put the code appears in the macro, with its corresponding macro value substitution, this process is a bit of you I in the word processing software in the search and replace. So using a macro to express a constant in your code, in the final analysis, uses an immediate number and does not explicitly specify the type of the quantity.
Const section
The format for a constant definition is:
Const data type constant name = constant value;
Constants defined by const have data types, and constants that define data types make it easy for the compiler to perform data checks, which can cause errors in the program to be checked. Constants must specify a value at the beginning, and then, in future code, we are not allowed to change the value of this constant.
The difference between the two:
Allocation of memory space. Define the macro definition, the memory space will not be allocated, the compilation will be replaced in the main function, just a simple substitution, no checks, such as type, statement structure, that is, the macro definition constant is purely a placement relationship, such as # define NULL 0; The compiler always uses 0 instead of NULL when it encounters null it has no data type (see the Pre-Processing section or MSDN for a C-language book). Whereas const-defined constants have data types, constants that define data types make it easy for the compiler to check for data, which can cause errors in the program to be checked. So the difference between const and define is that the const definition constant excludes the unsafe between programs.
Source: >
From for notes (Wiz)
The difference between const and define in PHP