When I first learned to write code, I didn’t understand what functional programming really was. I knew PHP. I knew JavaScript. Both languages us

Is PHP a functional programming language?

submited by
Style Pass
2022-01-17 18:30:19

When I first learned to write code, I didn’t understand what functional programming really was. I knew PHP. I knew JavaScript. Both languages used functions, and a number of books called them functional, so I assumed they were both functional programming languages.

As a kid, I’d learned to write QuickBASIC with my father. It was a great exercise, and we had a blast copying simple programs – by hand – from the back of books into our computer. Our programs were filled with “sub-routines” to make code reusable.

These blocks of resuable code were not called functions and QuickBASIC was clearly not a functional programming language. Those two differences cemented in my mind what I would and wouldn’t consider functional programming later in my career.

Any functional programming language must not just support all three of these concepts. That language needs to emphasize these concepts. It must, by default, focus on functions as the primary means of programming and remove the option of mutability to ensure the purity of data.

Leave a Comment