Access Specifiers in PHPThere are 3 types of Access Specifiers available in PHP, Public, Private and Protected. Public - class members with this access modifier will be publicly accessible from anywhere, even from outside the scope of the class. Private - class members with this keyword will be accessed within the class itself. It protects members from outside class access with the reference of the class instance. Protected - same as private, except by allowing subclasses to access protected superclass members. EXAMPLE 1: PublicOutput: ![]() EXAMPLE 2: PrivateOutput: ![]() EXAMPLE 3: ProtectedOutput: ![]() EXAMPLE 4: Public,Private and ProtectedOutput: ![]()
Next TopicPHP OOPs Const keyword
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week