SDF
SDF

Reputation: 1331

Defining a constant in PHP

I define/initialize the constant like this in my code:

if(!define('CHECKLIST'))
{
    define("CHECKLIST",FALSE);
}

But it doesn't work and I got a warning error.

Warning: define() expects at least 2 parameters, 1 given in PHP

Upvotes: 0

Views: 398

Answers (1)

Kevin
Kevin

Reputation: 41885

You check whether its defined first.

if(!defined('CHECKLIST')) {
    define('CHECKLIST', FALSE);
}

Upvotes: 6

Related Questions