DEV Community

Discussion on: What are your thoughts on functional programming? In PHP?

Collapse
 
itsjzt profile image
Saurabh Sharma

These are some nice to have features in functional programming languages.

  • Function can be passed to other functions and returned as values. In short functions should be treated as values.

  • closures the inner function can use the variables of outer function regardless of where it is running.

  • Map, filter, reduce like functions.

  • pipeline operator.

Thread Thread
 
ohryan profile image
Ryan

Unless I'm misunderstanding the terms, I believe PHP has all of these features except a pipeline operator.

Thread Thread
 
underscorefunk profile image
John Funk • Edited

It's a different language, but check out the ramda library for examples of really awesome functional programming. The documentation is great. Chris Okahravi has a superb video tutorial series on every single function in ramda too. —> youtube.com/playlist?list=PLrhzvIc...

If you REALLY want to get into it, check out Prof. Frisby's Mostly Adequate Guide to Functional Programming github.com/MostlyAdequate/mostly-a...

Thread Thread
 
drewknab profile image
Drew Knab

+1 for Frisby’s