What is the purpose of the object operator in PHP?

The object operator (->) in PHP is used to access methods and properties of an object. It is used to call a method or access a property within an object context. This operator is essential for working with object-oriented programming in PHP. Example:

class Person {
    public $name;

    public function sayHello() {
        echo "Hello, my name is " . $this->name;
    }
}

$person = new Person();
$person->name = "John";
$person->sayHello();