Vidyalelo
PHP · Q3

Object Oriented Concept

Programming · PHP · question 3

Q3

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

A.
PHP 4
B.
PHP 5
Answer
C.
PHP 5.1
D.
PHP 5.3

Answer: Option B

Solution

Answer: Option B
Solution:
In PHP 4, all properties were declared with var keyword, which is identical in effect to using public. For the sake of backward compatibility, PHP 5 accepts var in place of public for properties.