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

Mixing procedural and object-oriented programming in PHP can lead to code that is difficult to maintain and understand. It can also result in inconsistencies in coding style and make it harder to debug issues. To solve this problem, it is recommended to choose one programming paradigm and stick to it throughout the project.

// Example of using only object-oriented programming in PHP

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();