Change the value of a previously-defined constant

It is possible to redeclare define, when it was previously defined as case_insensitive constant (3rd parameter).

See:

$ php -r "define('TEST','foo',true); var_dump(TEST); define('TEST','bar'); var_dump(TEST);"
string(3) "foo"
string(3) "bar"

Tested with PHP CLI 5.2.6 and 5.5.3.


From http://php.net/manual/en/function.define.php (emphasis is mine):

define — Defines a named constant

From http://www.php.net/manual/en/language.constants.php:

As the name suggests, that value cannot change during the execution of the script

Tags:

Php

Constants