please explain constant variable in php ?

Programming
Tutor: None Selected Time limit: 1 Day

please explain constant variable in php ?

Aug 4th, 2015

Thank you for the opportunity to help you with your question!

Defining a constant in PHP can come in handy when working with a value that will be used throughout your script. What is a constant exactly? According to PHP.net, “A constant is an identifier (name) for a simple value“. One important thing you need to know is that, like its name states, a constant cannot be changed. That is pretty much the main difference between a constant and a variable.

Here is a basic example:

<?php define("SITE","bavotasan.com"); define("AUTHOR","c.bavota"); echo SITE // outputs bavotasan.com echo AUTHOR // outputs c.bavota echo SITE." by ".AUTHOR // outputs bavotasan.com by c.bavota?>

Simple enough. Just remember that constants are case sensitive, so this wouldn’t work:

<?php echo Site;?>

Unless, of course, you set a third parameter within the define() function to control the case. By default, it is set to false, which is case-sensitive. To make it case-insensitive, all you need to do is set that third parameter to true.


Please let me know if you nea case for torture by michale levined any clarification. I'm always happy to answer your questions.
Aug 4th, 2015

Are you studying on the go? Check out our FREE app and post questions on the fly!
Download on the
App Store
...
Aug 4th, 2015
...
Aug 4th, 2015
Dec 6th, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer