..
To define a constant in PHP using the define () function. Here's an example:
define ('NOMECOSTANTE', 'constant value');
if the value is numeric, of course, does not need the quotes.
For practice, usually, the names of the constants are capitalized.
Note that the constants, unlike variables, are not preceded by a dollar sign ($).
Let's see an example of using a constant:
NOMECOSTANTE echo;
If we try to change the value of a constant:
NOMECOSTANTE = 'new value';we get, obviously a mistake.
| |
Linux (Course)
Complete guide to open-source system. From 49 €. |
| |
MySQL (Course)
Management of open-source database. From 39 €. |
| |
PHP (Course)
Full course for creating dynamic Web sites. From 49 €. |