- Constant of any assigned value never be change in an execution of program.
- If assign value in a constant then the value of it never change means it stored value permanent.
- define( ) function is used for define a constant it has three parameter.
- parameter is Name of Constant,Value of Constant and Case-sensitive case-sensitive is optional for remove case-sensitive of constant name.
- For remove the case-sensitive of constant name we pass the true in third parameter.
define("Name of constant","Value of Constant");
<?php define("Message","Hello php!"); echo "constant Message=".$Message; define("MSG","Hello world!"); echo "constant MSG".$MSG; ?>
constant Message=Hello php! constant MSG=Hello world!
Example after remove case-sensitive from constant
<?php define("MSG","Hello world!",true); echo "constant MSG".$msg;//we can call constant MSG as lower form msg using third optional parameter ?>
constant MSG=Hello world!//after pass the true in third parameter remove the case-sensitive on constant name
Hello, My Name is pradip parker . I am a Web Developer, Professional Blogger from India. i love and like web designing and developing, i have two year of experience in programming and developing I am the founder of programmingconcept. I started this blog in 2017 to for help developers by providing easy,small and best tutorials.