What does "->" mean in PHP syntax?
In PHP syntax, "->" is used to access methods and properties of an object. It is known as the object operator and is used to call a method or access a property of an object. To use "->" in PHP, you need to have an object instance created from a class that defines the method or property you want to access. Example:
class MyClass {
public $property = 'Hello, World!';
public function myMethod() {
echo 'This is a method.';
}
}
$object = new MyClass();
echo $object->property; // Output: Hello, World!
$object->myMethod(); // Output: This is a method.