PHP CONSTANTS

Опубликовано: 11 Июнь 2026
на канале: Code Net
16
0

In PHP, a constant is an identifier (name) for a simple value that cannot be changed during the execution of a script. Once a constant is defined, its value cannot be altered or redefined. PHP constants are useful for storing values that do not change, such as configuration settings or mathematical constants.

To define a constant in PHP, you can use the define() function, which takes two arguments: the name of the constant and its value.

E.g:
define("PI", 3.14159);