phpconstants

constant already defined in php


I have a function that I am trying to run but it shows the message as CONSTANT already defined.

I tried to put a condition saying "if defined" about the function but still nothing. Is there any method to ignore this and see the output?


Solution

  • Replace this:

    define('constant', 'value');
    

    with this:

    if (!defined('constant')) define('constant', 'value');