What is the difference between accessing an object property in PHP using '->' and '['']'?

When accessing an object property in PHP, you can use '->' to access properties directly by their name, while you use '['']' to access properties indirectly by using a variable containing the property name. The '->' operator is used for direct access to properties defined in the class, while the '['']' operator is used when the property name is dynamic or stored in a variable. Example: $object->property_name; // Direct access using '->' $property_name = 'property_name'; $object->$property_name; // Indirect access using '['']'