What are the important OOP features in PHP 5.0?

PHP 5.0 introduced important Object-Oriented Programming (OOP) features such as visibility keywords (public, private, protected), abstract classes, interfaces, and constructor and destructor methods. These features help in organizing code, improving code reusability, and enhancing code maintainability.

// Example demonstrating the use of OOP features in PHP 5.0

// Defining a class with visibility keywords and constructor method
class Person {
    private $name;
    protected $age;

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

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

    public function getAge() {
        return $this->age;
    }
}

// Creating an instance of the Person class
$person = new Person("John Doe", 30);

// Accessing properties and methods using object instance
echo "Name: " . $person->getName() . "<br>";
echo "Age: " . $person->getAge();