How can PHP constants be properly defined and used to avoid assumptions and errors?

When defining PHP constants, it is important to use all uppercase letters and underscores to separate words in the constant name. This convention helps differentiate constants from variables. Additionally, constants should be defined at the beginning of the script before they are used to avoid any assumptions or errors.

define("MAX_LENGTH", 10);

echo MAX_LENGTH;