1. Home
  2. Computer Science MCQs
  3. PHP
  4. Which characters is used to access property variables on…

Added 22 Jan 2024

Which characters is used to access property variables on an object-by-object basis?

  1. ::
  2. =
  3. -> Correct answer
  4. .

Correct answer

C. ->

16 views

MCQSEXAM

Explanation

The object operator -> is used to access the properties and methods of a specific object, as in $product->title.

The scope resolution operator :: is used instead for static members and class constants, the dot is for string concatenation, and = is assignment. Mixing up -> and :: is one of the most common beginner mistakes in PHP OOP.

For more solved questions like this one, see Computer Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More PHP MCQs

Practise all PHP MCQs

Similar MCQs