Wednesday, April 20, 2011

PHP Access Specifiers

Access Specifiers are the keywords in PHP, which will tell us about the visiblity of property or method.
Public, Private and Protected are the three Access Specifier Keywords in PHP. Below is the difference between each of them.
Class members declared public can be accessed everywhere.
Members declared protected can be accessed only within the class itself and by inherited and parent classes.
Members declared as private may only be accessed by the class that defines the member.
Default access specifier is Public.

1 comment: