Constant variable in PHP using define - PHP Views : 380
Tagged in : PHP
0 0
Send mail
The PHP constant is very similar to a PHP variable in that it is used to store a value but, unlike a variable, the value cannot be changed.

As the name indicates, the variable will be constant through out the programs life cycle.

We can use the function define to declare and set a value for the constant.

Example:

define("CONSTANT_NAME", "value");

echo CONSTANT_NAME;


This will give the output as "value"
By rajesh, On - 2010-01-02



    Login to add Comments .