Refactoring Strings to Enums This article describes the journey of refactoring a not-so-old piece of code from using strings to using enumerations. Original Reasons When Exakat was started in 2014, enumerations were not even on the radar. Strings, and sometimes constants, were the obvious solution. As the original concept evolved quickly, strings were used everywhere, […]
All PHP 8.5 hash algorithms Choosing the right hashing algorithm is difficult, balancing the need for security, speed, and reliability. PHP offers a almost 60 built-in hashing options, but not all are created equal : some are industry standards for cryptographic security, while others are optimized for lightning-fast non-cryptographic tasks like caching or checksums; some […]
Convert a string to integer with PHP PHP 8.5 provides a new error message when one tries to convert a string to integer with PHP. The float-string “%s” is not representable as an int, cast occurred This is new with this version, and besides the warning itself, it is not even a changed behavior. It […]
Understanding Relationships Between Classes, Interfaces, Traits, and Enums in PHP Modern PHP offers four major code structures — classes, interfaces, traits, and enums — each with its own purpose and rules. But the real power of PHP comes from how these structures can interact with each other. This page gathers all relations between classes in […]
Infinite loops in PHP Sometimes, they are demonized, and sometimes, they are useful. Infinite loops come in a variety of options in PHP, so let’s put them neatly on a shelf, with all theirs variations. Classic while (true) To make an infinite loop, the most simple is to take a loop, and make it unconditional. […]
Quines for PHP A quine is a piece of code that executes to produce itself. This is a self displaying code. The execution of the code outputs the same source code, before it was executed. No changes happened, and one may run it again, to the same result. While this code curiosity has rare direct […]
The Required, The Optional, The Useless, and The Weird: of In PHP, parentheses () aren’t just punctuation : they play different roles depending on where and how they’re used. Some are compulsory, others are optional, and a few are just useless clutter. And then, there’s the weird one: (cast). Let’s review all PHP parentheses usages […]
Speed up ksort() ksort()is the PHP native function that sorts an array by its keys, while maintaining the relationship with the values. It has been in the language since the beginning (last millenium!), and yet, sometimes, it is interesting to ask again some old questions: can I speed up ksort()? Let’s see. ksort(), sorting by […]
Adoption levels of recent PHP features While browsing the PHP devsquad, I ran into this article that listed the top 10 powerful features of PHP. Beside the list, it made me wonder what are the adoption levels of recent PHP features, based on this list. Once in a while, I like to check such top […]











