What are the potential pitfalls of mixing procedural and object-oriented styles in PHP code?

Mixing procedural and object-oriented styles in PHP code can lead to confusion, inconsistency, and decreased code readability. It can also make maintenance and debugging more challenging. To address this issue, it's best to choose one style (either procedural or object-oriented) and stick to it throughout the codebase.

// Example of sticking to object-oriented style in PHP code
class User {
    private $name;

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

    public function getName() {
        return $this->name;
    }
}

$user = new User('John Doe');
echo $user->getName();