PHP Programming/Overriding and Overloading

Overloading
Overloading in PHP provides means to dynamically "create" properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types. In other terms creating properties/methods at run-time is called property overloading/method overloading.

Property overloading
In PHP, property overloading can be done by magic methods like __set, __unset, __isset, __get method. Overloading can be done by magic methods like __call and __call_static. PHP's interpretation of "overloading" is different than most object oriented languages. Overloading traditionally provides the ability to have multiple methods with the same name but different quantities and types of arguments.

Method overloading
When we try to call a method that doesn't exist in PHP, __call is called and that way we achieve Method Overloading.

Overriding
In OOPs meaning of overriding is to replace parent class method in child class. Or in simple technical word method overriding mean changing behavior of the method. In OOP overriding is process by which you can re-declare your parent class method in child class. So basic meaning of overriding in OOP is to change behavior of your parent class method.

Normally method overriding required when your parent class have some method, but in your child class you want the same method with different behavior. By overriding of method you can completely change its behavior from parent class. To implement method overriding in OOP we commonly create same method in child class.