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.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments