In php we have both constant and variable
A constant is a name for a value which can not be changed during the execution of the script.
It start with a letter or a underscore.
It start with constantname().
The differences-
There is no need to write the $ sign with a constant where as with a variable you have to write it as $name.
Constant can not be declared directly they can only be declared under the define().
They can be defined and can be accessed anywhere.
Once set it can not be undefined or redefined.
Constant name-
valid constant names define("ONE", "first thing");
define("TWO2", "second thing");
define("THREE_3", "third thing")
Variable name-
$name.
0 Comment(s)