Welcome Guest, Not a member yet? Register   Sign In
own CONSTANT?
#5

[eluser]Unknown[/eluser]
Hi,

A constant stays constant.
You can change it by changing your script.
Next invocation it will be changed. It is simply read every time you run the script.
For example: If you put this in your index.php:
define("JOSSISCONSTANT", 25);
It will be avialable as JOSSISCONSTANT.

Problem: You have to watch the scope.

Easier is this maybe:
$GLOBALS['JOSSISCONSTANT'] = 25;
And then refer to this everywhere you need it via $GLOBALS['JOSSISCONSTANT'].
That should also work from within functions/methods/whereever you need it.


Messages In This Thread
own CONSTANT? - by El Forum - 03-22-2012, 07:22 AM
own CONSTANT? - by El Forum - 03-22-2012, 07:46 AM
own CONSTANT? - by El Forum - 03-22-2012, 07:50 AM
own CONSTANT? - by El Forum - 03-22-2012, 07:56 AM
own CONSTANT? - by El Forum - 03-22-2012, 08:07 AM
own CONSTANT? - by El Forum - 03-22-2012, 08:36 AM
own CONSTANT? - by El Forum - 03-22-2012, 02:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB