Constants in PHP

Constant SITE_NAME: My PHP Website

Constant PI: 3.14159

Explanation

Constants in PHP are like variables, but once defined, their values cannot be changed during the script's execution. Constants are defined using the define() function or the const keyword. Unlike variables, constants do not start with a dollar sign ($), and they are global by default, meaning they can be accessed anywhere in the script.

Back to Home