Home / PHP Tips Generated By ChatGPT / Checking if a Constant is Defined in PHP Determine if a constant has been defined using defined(). Source Code define("MY_CONSTANT", 1); if (defined("MY_CONSTANT")) { echo "MY_CONSTANT is defined."; }