PHP 8: Making the Choice Between "switch" and "match"
PHP 8 brought an innovative feature - the match expression. It is an effective counterpart to switch. Let's explore their distinctions.
Articles about PHP, software architecture, algorithms and more.
PHP 8 brought an innovative feature - the match expression. It is an effective counterpart to switch. Let's explore their distinctions.
As code bases grow, maintainability & predictability is getting more a key strategy. Read here more about immutability & readonly classes.
Read more about PHP WeakMap data structure added with version 8. WeakMaps are helpful for memory management and avoid leaks.
Discover PHP's evolution, shifting focus from resources to objects, offering enhanced programming capabilities.
PHP Attributes were added with version 8. In this post, I give an overview and my opinion on where and how to use them.
Pure Intersection Types in PHP8.1 are a language feature to have more control over return and parameter types.
Fibers are introduced to PHP and are a elegant way to simulate parallel work. Read more about how they differ from threads and coroutines.
Finally enums were added to PHP. As a little time has passed, I'll give an overview & continue with personal thoughts about when & how to use.
Readonly properties are introduced with PHP 8.1. and allow creating immutable objects easier. Read here about the difference to getters/setters.
Mocking in unit tests is a powerful technique. This post addresses when and how to use mocks properly in PHP.