How do I define a constant in PHP?
And here is how:
<?php
define('NAME', 'Tarquin');
?>
This defines a constant called NAME and assigns it the value of Tarquin. Now assuming you don't ever change your name (well, maybe if you're called Tarquin...) then this would be a possible instance of defining a constant.
How do you access it? Like this:
<?php
echo 'Hello, ' . NAME;
?>
It is very important to note that the constant is printed outside of any quotation marks; include it within them and you will just see NAME printed to screen rather than the actual value of the constant.
More other PHP Questions
Can PHP create PDF files for me?How can I stop my PHP script timing out?
How do I find out about my PHP installation?
How can I add branching logic to my PHP code?
How do I check if a date entered exists?