This is the fifth part of a series of articles about Functional Programming in PHP. Previous parts:

Introduction
Currying
Function Composition
More Functions

The Reluctant Code

You won’t admit you love me.
And so how am I ever to know?
You only tell me
Perhaps, perhaps, perhaps.

So far we only saw strong-minded functions that are explicit and resolute. It turns out that our code also can be reluctant. And by that I don’t mean reluctant to reveal the exact location and source of bugs in our program. We know that way too well. …


This is the forth part of a series of articles about Functional Programming in PHP. Previous parts:

Introduction
Currying
Function Composition

The first Functional Programming language, Lisp, derives its name from ‘LISt Processing’. Working with lists is a fundamental concept in FP. Imagine your favorite necklace of pearls and the reassuring feeling of moving your fingers through it one by one. This simple activity has such an enormous effect, that the string of beads happens to appear in various spiritual practices of major world religions form Buddhism to Christianity.

We will delay on this concept a bit as a means…


TIOBE — the software quality company — has just released its latest (April, 2021) statistics on the popularity of programming languages, the so-called TIOBE Index. They collect the data from several sources in parallel and update the list monthly. According to them, this list is intended to help developers and system engineers to decide which programming language to apply in a certain area, which can be considered a reasonable choice on a given field, which one to keep oneself updated with, or learn next, and which one to base your new project on.

Probably the most valuable outcome of populating…


This is the third part of a series of articles about Functional Programming in PHP. Previous parts:

Introduction
Currying

The Zen of modularity

If we ever want to reuse our code, we need to divide it into smaller chunks, that have well defined responsibility, and keep those parts modular enough to be considered building blocks for a bigger structure. We may have the first hand experience that balancing pebbles on top of each other at the river bank is considerably more of a challenge than building a wall from angular bricks.

It’s not enough to have building blocks that have uniform shape, because some…


In the previous article we walked through the foundations of Functional Programming (FP) in PHP. This was by far not a comprehensive introduction, but rather mentioned the most important concepts of FP along with the PHP features, that are necessary to start applying FP in PHP as soon as possible. In this part I assume you’re already familiar with those basics mentioned in the introduction, and I will drop more concepts in as we proceed with currying.

Spicing your code up

Although it sounds fancy, currying has actually nothing to do with your favorite turmeric mix, but derives its name from the American mathematician…


Why Functional Programming?

The web is getting filled with articles praising Functional Programming (FP), sometimes even starting with whipping Object Oriented Programming (OOP). Although the paradigm started to gain some momentum lately, there’s nothing new about it, considering it’s been around for 60+ years. You read that number right, FP may be older than your ma. So why is all the hype happening all of a sudden? Have the people of internet just reinvented the wheel? Does it take them so much time to learn a programming paradigm? But the OOP term itself is coined well after FP.

It’s not that anybody prevented…

Viktor Daróczi

A seasoned web developer nomad

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