1. Home
  2. Computer Science MCQs
  3. PHP
  4. Which attribute is used in PHP 8.2 to mark a class as…

Added 14 Sep 2025

Which attribute is used in PHP 8.2 to mark a class as readonly?

  1. #[ReadOnly]
  2. readonly
  3. readonly class Correct answer
  4. #[Immutable]

Correct answer

C. readonly class

14 views

MCQSEXAM

Explanation

readonly classes were introduced in PHP 8.2.

Reference

https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.reado…

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