Classes are used to define a real world thing, such as a person or a book. Once the class of thing has been defined then it can be instantiated.
An example class is below.
As you can see the the class is defined by using the class keyword followed by the name of the class which can be any non-reserved word in PHP. The variables and the function are all defined with the visibility modifier.
You will notice that the pseduo variable $this is used in the class. This variable allows functions and variables to be called from inside a class.
A class can be instantiated and called as shown below using the new
Classes can also contain static functions. A static function doesn't require the class to be instantiated as a normal object method does. However a static method can't use any of the objects non-static variables.
As you can see above the static function can use static class variables such as $bookTypes. A static variable or function can be accessed either via the self keyword or the class name inside the class and just the class name from outside it, as shown below.
A default value for a class variable must be a constant expression, so no concatanation or creating new classes!