A constant is an identifier for a given value.
A constant cannot be changed during the script as a variable can also unlike variables.
A constant is automatically global across the entire script.
When creating a constant the name must start with a letter or underscore a constant does not require
a dollar sign before the name is shown in this example.
A constant can be created using the defined function inside the function.
We start with the constant name followed by the value we can also specify whether the constant name
should be case insensitive.
We'll do that in the second example.
In this example the constant name is set to welcome.
The value is the text.
Hello my name is John Smith.
The constant name is case sensitive
we can output the constant by creating an echo statement followed by the constant name.
Welcome.
If we were to set the echo statement to lower case welcome the output wouldn't work first on the right
hand side.
We can see here that the output is correct its output at the value.
Hello my name is John Smith.
What if we were to change from uppercase to lowercase.
Now it does not match our constant need.
Well the case doesn't match and now we get an error because the case doesn't match.
So we'll change it back
in the second example we've set the case insensitive value to true shown here.
This means when we output are constant in this case.
Welcome to.
It doesn't matter if we use uppercase or lowercase for the constant name.
So you can see that the case here doesn't match in the echo statement.
And when we refresh this time it still works.
Constants are global and can be used across the entire script.
In this example we've defined the constant with the name car and set the value to Volvo.
We've also created a function my car that outputs the value of constant car using an echo statement.
When we run the function we can see that the browser outputs the value bobble.