What is the purpose of using constants in PHP classes?

Constants in PHP classes are used to define values that should not change throughout the execution of the program. They provide a way to store and reuse fixed values without the risk of accidentally modifying them. Constants can be accessed within the class using the `self::CONSTANT_NAME` syntax and outside the class using `ClassName::CONSTANT_NAME`.

class Circle {
    const PI = 3.14;
    
    public function calculateArea($radius) {
        return self::PI * $radius * $radius;
    }
}

$circle = new Circle();
echo $circle->calculateArea(5); // Output: 78.5