A classis a template used to create objects. To define one, the class keyword is used, followed by a name and a code block. The naming convention for classes is mixed case, meaning that each word should be initially capitalized.
class MyRectangle {}
The class body can contain properties and methods. Properties are variables that hold the state of the object, whereas methodsare functions that define what the object can do. Properties are also known as fields or attributes in other languages. In PHP, they need to have an explicit access level specified. In the following, the public access level is used, which ...