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
Explain the difference between $message and $$message?
How to merge values of two arrays into a single array?
which will print out the php call stack?
Does browser understand php?
Does php 5 support exceptions?
What is the difference between single-quoted and double-quoted strings in php?
Explain what does the unlink() function means?
What are advantages of .htaccess?
I am writing an application in php that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with php?
Which database is best for php?
What is composer phar?
Does php have block scope?
How to store the uploaded file to the final location?
Which function you can use in php to open a file for reading or writing or for both?
How would you open a directory for reading in php?