PHP – First steps with the PHP language – part 003 .

You can see on the official website the latest release for version 8 on March 4, 2021.
The current name is from Hypertext Preprocessor and previously had a name originally Personal Home Page.
Although they have not solved their bugs – internet development is very versatile and this fact has repercussions at the level of affiliate programming languages.
At the moment it works very well and there are quite good implementations, see WordPress.
The official webpage with documentation translated into several languages contains only the documentation and few concrete examples.
In order not to waste time, I will show you how to create a simple class in PHP with PHP Web Server using the website.
PHP includes a complete object model with these features are: visibility, abstract and final classes and methods, additional magic methods, interfaces, and cloning.
Classes and objects are the two main aspects of object-oriented programming.
Objects of a class are created using the new keyword.
A class may contain its own constants, variables called properties, and functions called “methods.
They are defined by using one of the keywords public, protected, or private.
methods non-static properties may be accessed by using object operator ->, see example:

The Scope Resolution Operator, also called Paamayim Nekudotayim is a double colon is a token that allows access to static, constant, and overridden properties or methods of a class.

You can see my example with a simple class named Human:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.