Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 the creation of class constants.

define() used to create case-insensitive constants, and this was abandoned in version 7.3.

define() cannot create class constants.

<?php
    define('HELLO', 'Hello');
    
    print HELLO . " world\n";
?>

Documentation

See Also