Which version of PHP introduced the visibility keywords i.e public, private, and protected?
Correct answer
B. PHP 5
12 views
B. PHP 5
12 views
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.
Not sure why the answer is B? Ask here and get an explanation.