1. Home
  2. Computer Science MCQs
  3. PHP
  4. Which version of PHP introduced the visibility keywords…

Added 22 Jan 2024

Which version of PHP introduced the visibility keywords i.e public, private, and protected?

  1. PHP 4
  2. PHP 5 Correct answer
  3. PHP 5.1
  4. PHP 5.3

Correct answer

B. PHP 5

12 views

MCQSEXAM

Explanation

PHP 5 introduced the visibility keywords public, private and protected. In PHP 4 every property was declared with var and everything was effectively public.

Visibility is what makes encapsulation possible: private members are reachable only inside the class, protected members also inside child classes, and public members from anywhere.

Want more practice? Try the full set of Computer Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is B? 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