define()¶
define() is a PHP function, that introduces global constant definitions.
define() is a function, and may be called anywhere. It is slower than const, as it is only executed at runtime. define() doesn’t allow class constants creation.
define() used to create case-insensitive constant, but this was abandoned in PHP 7.3.
define() cannot create class constants.
<?php
define('HELLO', 'Hello');
print HELLO . " world\n";
?>
See also Problem: Define() vs Const in PHP.
Related : Const, Constants, Static Constant, defined(), Conditioned Structures, Execution Time