How can OOP be effectively applied in PHP for managing website content based on user input?

To effectively apply OOP in PHP for managing website content based on user input, you can create classes for different content types (e.g., articles, blog posts, products) and use methods to handle user input for creating, updating, and deleting content. This approach helps in organizing code, improving reusability, and maintaining scalability.

class Content {
    protected $title;
    protected $body;

    public function setTitle($title) {
        $this->title = $title;
    }

    public function setBody($body) {
        $this->body = $body;
    }

    public function saveContent() {
        // Save content to database or file
    }

    public function updateContent() {
        // Update content in database or file
    }

    public function deleteContent() {
        // Delete content from database or file
    }
}

// Example of creating a new article
$article = new Content();
$article->setTitle($_POST['title']);
$article->setBody($_POST['body']);
$article->saveContent();