Constants

In PHP, constants are like variables, but their values cannot be changed once they are set. They are useful for storing values that remain constant throughout the execution of a script. Here's an example using the constant PI:

Example 1: The value of PI is 3.14159.

Example 2: Calculating the area of a circle with radius 5 using the formula area = PI * (radius^2). The result is 78.53975.

Constants differ from variables in that they are declared using the define() function, and once defined, their values cannot be altered during the script's execution. They are typically used for values that should remain constant and unchanged throughout the code.