Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the value of a previously-defined constant

Tags:

I have defined a constant in PHP e.g.

define('CONSTANT_NAME', 'constant_value'); 

I want to be able to change the value of this constant later on in the code.

Can this be done? If so, how?

like image 750
Carl Thomas Avatar asked Dec 12 '11 22:12

Carl Thomas


1 Answers

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

like image 160
Oliver Charlesworth Avatar answered Oct 26 '22 22:10

Oliver Charlesworth