A constant may be defined as -starts with letter,underscore no $ sign is required like variable definition
this value not change in the entire script.
creating a constant we use the ‘Define’ keyword with 3 parameters
Define(‘constant name’,’value’,’optional parameter tot specify case-sensitive ‘) optional parameter is true.otherwise leave it blank.
case-sensitive constant- blank
case-insensitive constant-true
Example
——–
1 2 3 4 5 6 |
<? define("MYDOUBTS","Welcome to mydoubts.in"); echo MYDOUBTS; echo mydoubts; ?> |
ouput as below
Welcome to mydoubts.in
mydoubts
1 2 3 4 5 6 |
<? define("MYDOUBTS","Welcome to mydoubts.in",'true'); echo MYDOUBTS; echo mydoubts; ?> |
output as below
Welcome to mydoubts.in
Welcome to mydoubts.in