What is the typical way to handle incrementing values in PHP classes?

In PHP classes, a typical way to handle incrementing values is by creating a method within the class that increments the value each time it is called. This method can be called whenever you need to increment the value within the class.

class Counter {
    private $count = 0;

    public function increment() {
        $this->count++;
    }

    public function getCount() {
        return $this->count;
    }
}

$counter = new Counter();
$counter->increment();
$counter->increment();
echo $counter->getCount(); // Output: 2