Php - Define constant variable in php, Php constant variable

Define constant variable in php


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", "w3calculator");
 echo CONSTANT_NAME;

The output is "w3calculator"

The topic on Php - Define constant variable in php is posted by - Maha

Hope you have enjoyed, Php - Define constant variable in phpThanks for your time

Tech Bluff