How to Define a Constant in PHP? Is $ symbol necessary?
Answer Posted / abhishek baranwal
define("CONSTANT", "Hello world.");
echo CONSTANT; // Outputs Hello world
define("CONSTANT", "New Value");
echo CONSTANT; // Outputs Hello world
Means once you declair the define a constant value that
will become every time it will not take new value or it
will not redeclair.if you want change in value then declair
the variables for that purpose.
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
How to check curl is enabled or not in PHP
What are the ways to define a constant in php?
What are the methods to submit form in php?
What is php explain?
Where is php code written?
What are helpers in php?
How to write a program to make chess?
How to replace a substring in a given string in php?
What is a controller in php?
Tell me how can we check the value of a given variable is alphanumeric?
How to get the value of current session id?
What is inheritance in php with example?
Which database is best for php?
Are php variables global?
How long is session timeout?