Examveda

The operator used in PHP to access property of an object is . . . . . . . .

A. .

B. *

C. ->

D. @

Answer: Option C

Solution (By Examveda Team)

This question is about how you interact with objects in PHP, a popular programming language used for web development. Think of an object as a container that holds different pieces of information (like a person's name, age, or address).
To access these pieces of information, called properties, you use an operator. The operator is like a special symbol that tells PHP what you want to do.
Here's what each option means:
Option A: . This operator is used for accessing properties of classes. Classes are like blueprints for creating objects.
Option B: * This operator is used for multiplication in PHP.
Option C: -> This is the correct answer! The -> operator is used to access properties and methods of an object.
Option D: @ This operator is used for error control in PHP. It silences errors.
So, if you want to get the name of a person object, you would use the -> operator like this:
$person->name
This code would retrieve the value of the name property from the $person object.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous