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 differences between GET and POST methods in form submitting?
Is server side a session?
What are super global variables in php?
How do I sort numbers in php?
What is php in simple words?
Require_once(), require(), include(). What is difference between them?
Does https prevent csrf?
Is php used for frontend or backend?
How do you end a function in python?
What is the difference between client-side and server-side programming?
What is the main difference between asp net and php?
Which function is used to read a single character from a file in PHP.
What are the Advantages and Application Areas of PHP?
How check field is empty or not in php?
Is php free to use?