diff --git a/source/_posts/php.md b/source/_posts/php.md index 72e31ec..f886128 100644 --- a/source/_posts/php.md +++ b/source/_posts/php.md @@ -955,6 +955,37 @@ $user->createUser(); // Output ex: | 2025-06-18 14:06:09 | User created. $product = new Product(); $product->createProduct(); // Output ex: | 2025-06-18 14:06:09 | Product created. ``` + +## PHP Enums (PHP 8.1) + +### Enum Declaration & Use case {.col-span-3} + +```php + "Waiting for approval.", + Status::Approved => "Your request has been approved.", + Status::Rejected => "Your request has been rejected.", + }; +} + +$currentStatus = Status::Approved; +echo getStatusMessage($currentStatus); // Output : Your request has been approved. +``` + + ## Miscellaneous ### Basic error handling