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
What are the advantages of indexes in php?
What does the scope of variables mean?
Will php die?
Which function is used to strip whitespace?
What is traits? How it is used in php?
How could I install codeignitor ?
What is difference between array_merge and array_combine?
Tell me how to retrieve a cookie value?
What is == and === in php?
How can you send http header to the client in php?
What is $_ env in php?
Why do we show php code in browser?
What is list function with their uses.
Why do we use interface in php?
Tell me what is the difference between get and post?