Image for post
Image for post
Functional Programming in PHP book cover — created by Sam Njuguna

After five elucidatory posts about Functional Programming in PHP, I decided to include the rest of the series I — at the time — foresaw continuing as a series of blog posts, much like this one, in an eight-chapter opus. Upgrading, and therefore, improving the quality of the offerings of the volume is an almost perpetual proposition I have always acknowledged — a striving I have, since initial conceit, mused on. The latest iteration of my book, released on 2020–10–06, I believe, is an improvement on its predecessor.

The first of many improvements is the new content. I have…


Image for post
Image for post
Photo by Emile Perron on Unsplash

https://play.ht/articles/a5f8df9b0ffb

There is a plethora of data structures in the Computer Programming discourse: everything from the quintessential primitives — integers, floats, strings, and the like — to composite types, amalgams of the aforestated primitives — linked lists, objects, and arrays, among others — are essential in crafting a variety of metastable applications (staple of the craft). Tries are composite types that do not necessarily have the same prominence in programming parlance as say, an array or record/tuple but have significant viability that stems from their uniqueness.

A trie is a tree structure with a single empty parent node and multiple…


Image for post
Image for post
Photo by Caspar Camille Rubin on Unsplash

If you have given some of my earlier blog posts enough heed to attempt to understand the amalgam of PHP-implementable ideas at their core, you might notice my passion for CouchDB. I find that CouchDB interactions are apt for a period defined by a web-service zeitgeist: the service’s REST API gracefully abstracts a bevy of arcane Erlang OTP offerings and is — generally — easy to integrate into modern web applications. Despite recently creating an asynchronous PHP wrapper, there is room for more optimization: enter the PHP extension, couchdb_ext.

Said software is no longer undergoing tests in a secret…


Image for post
Image for post
Photo by aiden marples on Unsplash

In retrospect, 2018 delivered a plethora of Hip Hop music. Notable album releases in every month of the year ensured a ubiquity of the genre of Hip-Hop. After listening to multiple records many times throughout the year, I settled on a list of albums that I feel — warrant the most reverence in a jam-packed year. The enumeration to follow is a detailed list of my favorite Hip-Hop projects from 2018.

Street Gossip — Lil Baby

Street Gossip — Lil Baby

Say what you want about trap music — it is the zeitgeist in this reality. Lil Baby is one of the sub-genre’s golden…


Image for post
Image for post
Screen conveying PHP code. Photo by Luca Bravo.

PHP is on an upward trajectory — the more recent improvements to the language are a testament to this postulate. Preloading — a feature inspired by the Java Hotspot Virtual Machine — is yet another enhancement to the PHP runtime. Initiated as an RFC by Dmitry Stogov, preloading presents an upgrade to the Zend OPCache responsible for caching opcodes generated upon PHP code compilation.

The quintessence of preloading is storing PHP code in the OPCache thereby availing it to all dependent scripts as part of the language core. …


Image for post
Image for post
Functional Programming in PHP book cover — created by Sam Njuguna

My passion for Functional Programming is no esoteric subject. The book I recently finished is not only emphasis of my genuine state of enamoredness but is also a symbol of a nascent willingness to blossom as a software engineer. The book, an eight-chapter volume has a rich diversity of functional programming ideas distilled for intermediate to expert tier PHP audiences.

As stated in the preamble, the book is premised solely on Functional Programming — FP ideas in PHP to be more exact. As far as what to expect is concerned, the book contains straightforward, concise descriptions of arcane Functional…


Image for post
Image for post

PHP arrays are supercharged. Arrays in PHP are almost a defacto data structure. Useful for a litany of operations — serialization, JSON data manipulation, and even flow-control to mention but a few, PHP arrays are incredibly ubiquitous. There are, however, certain things that are negated by many array users.

Arrays are, in PHP, hash table implementations. Said fact might be tacit — the intricacies of low-level hash table implementations are not. PHP has, through many iterations of its existence, seen multiple changes to its core. Among the myriad of changes made to the language is the modification of the…


Image for post
Image for post
PHP elephant (Image courtesy of Pixabay)

It is no secret that PHP has declined in popularity in recent years. The explanations for the decline of one of the web’s darlings are quite colorable: the rise of JavaScript, the growth of more robust languages, and the inefficiencies of the PHP language core. I get a lot of scorn for writing PHP code — the purpose of this article is, therefore, a justification for my stubbornness. I not only intend to show exactly why I continue to write PHP code but also hope to dispell certain notions about the language.

PHP has improved significantly

The best place to start my defence…


Image for post
Image for post
bingo-functional artwork

Error handling can be a pain in the ass. The most common approach to error handling, using exceptions, is a staple of Object-Oriented Programming (OOP) codebases. The difficulty with using exceptions is that they are difficult to use when creating a coherent flow. Flow control constitutes the ethos of functional programming as it emphasizes a graceful, controlled transformation of state.

Exceptions, in my opinion, are impure because they can originate from sectors outside a current codebase. Also, exceptions, when caught in try-catch blocks can return values that are a far cry from the expected result of a function definition…


Image for post
Image for post

After elaborately explaining immutability and showing off some helper functions in the bingo-functional library, I will set my sights on construing the array_map, array_reduce, and array_filter functions. In the wise words of New York rappers Jay Z and Swizz Beatz, it is time to move on to the next one.

The next one is quite important. A microcosm of PHP’s rich array function base, array_map(), array_reduce(), and array_filter() are massively significant. The first, array_map() is especially useful for transforming all entries in one or more arrays. A handy tool to have, array_map’s simplicity is matched only by its robustness…

Lochemem Bruno Michael

I write PHP and I know things — kind of. https://chemem.site

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store