Constants are an important concept to learn because they can make your programs a lot safer. Imagine a program that converts hours into days. You might have a hoursPerDay constant that always equals 24. You can define constants, but once they are defined they can never be redefined or undefined. Unlike variables, constants never change throughout the entire program. Use constants whenever, for instance, you have a value you want to multiply all inputs by or a known natural constant such as pi. Because the program cannot change the constant’s value, it is guaranteed to work correctly.
You define constants differently than you do variables. With variables, you simply do something like this:
$variable = value;
You can change the value ...