Procedural Programming vs. Object-Oriented Programming (OOP)
Procedural programming – writing procedures/functions that performs operations on the data.
Object-oriented programming – creating objects that contain both data and procedures/functions.
Object-oriented programming has several advantages over procedural programming:
- OOP is faster and easier to execute
- OOP provides a clear structure for the programs
- OOP helps to keep the PHP code DRY “Don’t Repeat Yourself”, and makes the code easier to maintain, modify and debug
- OOP makes it possible to create full reusable applications with less code and shorter development time
Tip: The “Don’t Repeat Yourself” (DRY) principle is about reducing the repetition of code. You should extract out the codes that are common for the application, and place them at a single place and reuse them instead of repeating it.
src – https://www.w3schools.com/php/php_oop_what_is.asp