It allows you to access properties on an object;
In PHP
class Car {
public $make;
public $model;
public function setMake($make) {
$this->make = $make;
}
public function setModel($model) {
$this->model = $model;
}
public function getMake() {
return $this->make;
}
public function getModel() {
return $this->model;
}
}
$car = new car();
$car->setMake("BMW");
$car->setModel("Three Series");
echo "Make: " . $car->getMake() . " Model: " . $car->getModel();
solved Use of -> in PHP and C++ [duplicate]