Q832
Which operator is used to access property of an object in PHP?
A.
.
B.
*
C.
->
AnswerD.
@
Answer: Option C
Solution
Answer: Option C
Solution:
This question asks about how you "get into" an object in PHP to grab specific pieces of information, called "properties". Imagine an object like a box, and the properties are the things inside.
We need an operator to tell PHP: "Hey, I want to look inside this object and get the property called '____'"
Here's the breakdown of the options:
Option A: . This is used to access properties of classes, not objects. Think of it like a blueprint for making objects.
Option B: * This is for multiplication. It doesn't help us with objects.
Option C: -> This is the winner! The arrow operator (->) is the key to accessing object properties. It's like saying "go inside this object and grab the property I'm pointing at".
Option D: @ This is used for error suppression. It's not for accessing properties.
So the correct answer is Option C: ->