<?php
class Person {
public $name;
public $age;
public function __construct($name, $age) {
$this->name = $name;
$this->age = $age;
}
public function getInfo() {
return "Name: " . $this->name . ", Age: " . $this->age;
}
}
$person = new Person("John", 30);
echo $person->getInfo();
?>Name: John, Age: 30name` and `age`, a constructor that sets the values of those properties, and a public method `getInfo()` that returns a formatted string with the name and age of the person.new` keyword followed by the name of the class and any arguments required by the constructor. We then access the object's properties and methods using the arrow operator `->`.