PHP OOP Child Classes


PHP OOP Child Classes

Child classes belong to the parent class but can be customized. Child classes can have separate properties and methods and inherit those from the parent class. The example below shows how to write a parent class and a child class in a single file.

class my_class {
}
class my_new_class extends my_class {
}