Website Development

Private and protected member variables and methods

PHP or PHP hypertext Preprocessor is a generalist and Open source scripting language. The purpose of its design is to allow developers to design web applications. It is very easy to integrate it with HTML. In the development of this language, there is what is called "object-oriented programming". The visibility of properties as well as the methods of an object constitute precisely one of the particular and basic characteristics of this one.

What is the visibility of the properties and methods of an object?

We speak of "visibility" in the universe of a php programmer to define how an attribute or method of an object should be accessible in the program. Like ActionScript 3, C ++ or Java, PHP also has 3 different levels of visibility. They can be applied to the methods or properties of the object. We are talking here of protected, private or public visibilities which are determined in the class via key, "public, private and protected" expressions. To the neophytes, understanding this language is difficult. Ideally, tutorials could be found online that allow them to see examples that illustrate the syntax of declaring member data (attributes) and methods with different visibilities. They better explain each particularity of the levels of visibility.

The 3 three different PHP accesses

This is public access, private access and protected access. The first type of access is the default access of PHP in the case where no visibility has yet been designated. The second one allows the php programmer to make a declaration of the methods and attributes that will only be visible or accessible once inside the class. The last type of access is an intermediary between the first two accesses already mentioned. If one wishes to use common methods and attributes in a parent class and its inherited or derived classes, one can rely on protected access. Again, understanding these accesses would be easier if one uses the tutorials that several websites offer.

Blog

  1. 12 Mars 2018The technics to launch a DDOS attack38 aff.
  2. 6 Déc. 2017Discover more about Cloudworks102 aff.