Functional Programming with PHP
2h 27mAdvanced2020-02-27
Authors

Shaun Wassell
Full-Stack Software Developer
Course details
Discover how to write more readable, maintainable PHP code by taking up functional programming. In this course, Shaun Wassell helps you get up and running with this popular programming paradigm. Shaun begins by covering fundamental concepts, including why functions and data are kept separate in functional programming and how to work with first-class functions in PHP. He then delves into the functional aspects of PHP, highlighting the built-in functions and features that allow you to work with arrays functionally, as well as filter, reduce, and sort lists of items. He also covers some more advanced concepts, such as recursion and partial application. To wrap up, Shaun shares code conversion challenges that allow you to put your new skills to the test.
Skills covered
PHPProgramming LanguagesOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - A functional approach to transform code
- 02 - What you should know
- 03 - Installing and running PHP
1. Introductory Functional Concepts
- 04 - Why use functional programming
- 05 - What is declarative programming
- 06 - Immutability in functional programming
- 07 - Separation of data and functions
- 08 - First-class functions
2. First-Class Functions
- 09 - Functions as data, part 1
- 10 - Functions as data, part 2
- 11 - Passing functions as arguments
- 12 - Returning functions
- 13 - Closure
- 14 - Higher-order functions
- 15 - Arrow functions in PHP
3. PHP - The Functional Parts
- 16 - Working with arrays, functionally
- 17 - The spread operator and array merge
- 18 - Mapping
- 19 - Filtering
- 20 - Passing keys to array functions
- 21 - Sorting
- 22 - Custom sorting behavior with usort
- 23 - Reducing
- 24 - Combining array functions
- 25 - Challenge - Recreating the array map function
- 26 - Solution - Recreating the array map function
4. Advanced Functional Concepts
- 27 - Advanced functional concepts
- 28 - Partial application and currying
- 29 - Recursion
- 30 - Composition, part 1
- 31 - Composition, part 2
5. Code Conversion Challenges
- 32 - Challenge - Property getter
- 33 - Solution - Property getter
- 34 - Challenge - Tallying votes
- 35 - Solution - Tallying votes
- 36 - Challenge - Value or array
- 37 - Solution - Value or array
Conclusion
- 38 - Next steps