<?php
class Person {
public $name;
public $age;
function __construct($name, $age) {
$this->name = $name;
$this->age = $age;
}
function getDetails() {
return "Name: " . $this->name . ", Age: " . $this->age;
}
}
// Creating objects of the Person class
$person1 = new Person("John", 30);
$person2 = new Person("Mary", 25);
$person3 = new Person("Bob", 40);
// Accessing attributes of the objects
echo $person1->getDetails() . "\n";
echo $person2->getDetails() . "\n";
echo $person3->getDetails() . "\n";
?>