Category Archives: PHP
Understanding SOLID using PHP
SOLID is a set of principles in object-oriented programming that, when followed, can lead to more maintainable and scalable software. SOLID is an acronym, and each letter represents one of the principles. Let’s go through each principle with examples in PHP: 1. Single Responsibility Principle (SRP): A class should have only one reason to change….
Enum in PHP
Although the concept of enums is not novel in programming, PHP introduced this feature relatively recently, with its 8.1 version. Now, let’s explore the possibilities it offers. Enum in PHP is declared in this way: enum OrderStatus { case PENDING; case CONFIRMED; case SHIPPED; case DELIVERED; case CANCELLED; } So it represents a collection of…