What is a constant in PHP?

Similar to a variable in PHP, a constant can be defined as an identifier for a specific value. Contrary to variables constants have a fixed value which will always remain the same during the script execution. If a value cannot be changed or should not be changed a constant should always be used and the use of a variable should therefore be avoided.



Was this useful?