A Brief History of PHP and Functional Programming

Learn about the history of PHP and the functional programming paradigm.

Depending on our preferences and general programming knowledge, PHP is a decent scripting language for the web. Though some may argue that PHP’s relatively easy learning curve and informal syntax indicate lousy architecture, it’s still a language worth exploring.

It was started by Rasmus Lerdorf, then 26 years old, who wrote C (mainly because it was normative to do so then). He wrote CGI scripts in the C language to create a templating engine running on a web server. This templating language, PHP, skyrocketed in popularity shortly after its birth because of its intuitive syntax. Pseudo-developers felt encouraged as demand for more features followed.

The desired features extended the scope of the templating language and made it attractive for implementing business-logic. Over the years, PHP has improved through each version. Co-authored by Andi Gutmans and Zeev Suranski, the jump from version 2.0 to 3.0 made it look a lot more like the version we have today. It was followed by transitions from version 4.0 to 5.0, and then to 7.0 onwards.

A formal specification (canonical blueprint of a language’s capabilities) is vital for a programming language’s lifecycle.

Note: PHP didn’t have a proper specification until 2014!

Note: PHP’s specifications can be found online at php.net.

A brief history of functional programming

The roots of functional programming are traceable to the pioneering works of the scientists Alonzo Church and Alan Turing. Church’s lambda calculus and Turing’s Universal Machine, both formalized sometime in the 1930s, form the very foundation of functional programming. Through his calculus, Church advanced a proto-functional syntax that emphasizes the principles of abstraction and generalization. Turing’s contribution was the invention of a device that could transform computable inputs to outputs, in a somewhat similar way to how humans compute logic operations.

Machine-aided programming soon followed. Lisp, which was the first modern functional language that was developed around 1958, introduced a new era of using functions and algebraic structures to define computer programs. Lisp still exists today and is considered an ancestor of most modern functional languages like Clojure, Erlang, and Scheme. The enthusiasm towards it, and towards functional programming as a whole, diminished somewhat in the period that followed.

Decline of functional programming

In the 1970s, when more procedural and object-oriented strategies became widely spread, functional programming lost its popularity to C and Smalltalk. Functional programming’s popularity continued to decline in the following decades as languages like C++ and Java made significant headway in programming circles. The paradigm had been effectively pushed out of the mainstream to academia before a more recent resurgence. Haskell is a popular example of a pure functional language, which was created in academia (named after renowned mathematician Haskell Curry.)

Revival of functional programming

Functional programming has recently gained some prominence. Everything from using the paradigm technique to integrating full-fledged conceptual frameworks built on other complex paradigm ideas has become more common. There’s undeniably some sort of library associated with functional programming present in anyone’s favorite or second-favorite programming language ecosystem. It shows the zeal for expressing programs as a juxtaposition of function compositions and immutable states.

The legacies of Alonzo Church’s lambda notation and Turing’s analytical machine live on universally. In PHP, the support of first-class functions and expressive syntax align well with computing through functions.