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
Where to put php files in apache server?
Is php front end or back end?
Tell me what is htaccess?
What is a php array?
How be the result set of mysql handled in php?
What are the functions used in php?
How to declare an array in php?
When do you use define() and when do you use const. What are the main differences between those two?
Is php better than python?
How many functions are there in php?
Is php procedural or oop?
Which methods should be used for sending an email using the variables $to, $subject, and $body?
What is rest api in php?
Where php basically used?
What is a php namespace?