Define Constants can not be redeclared in php

while working on an email template script i had a situation like this yesterday.
i had an include file where
define (‘HTML_EMAIL’ , ‘false’) was defined.
on another file i wanted to change the value HTML_EMAIL to true.
the first thought came to mind is to redeclare the constant and i tried like below,
define (‘HTML_EMAIL’ , ‘true’) on another file // not correct
when i called for the value then HTML_EMAIL value was false as old value.
it happened because i tried to assign value to a CONSTANT ( as it is already declared on include file).
well if value can be changed then it can not be a constant.
so defined constants can not be redeclared in php again.
try to use variables on similar situations.

Comments

Popular posts from this blog

How to call php functions inside smarty template directly

PHP / SQL Security – The Big Picture

Top 50 Web Hacking Techniques