What are the potential pitfalls of using static properties in PHP classes?

Using static properties in PHP classes can lead to issues with maintaining state and can make code harder to test and debug. To avoid these pitfalls, consider using dependency injection to pass necessary data into class methods instead of relying on static properties.

class Example {
    private $data;

    public function __construct($data) {
        $this->data = $data;
    }

    public function processData() {
        // Use $this->data here instead of relying on static properties
    }
}

// Usage
$data = 'example data';
$example = new Example($data);
$example->processData();