O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Functional Programming in PHP

Book Description

Functional Programming in PHP will show you how to leverage new language features of PHP by understanding functional programming principles.

Table of Contents

  1. Dedication
  2. About the Author
  3. Acknowledgements
    1. 0.1 Cover Design
  4. 1 Introduction
    1. 1.1 Prerequisites
    2. 1.2 Requirements
    3. 1.3 For Users of Older PHP Versions
    4. 1.4 Installing
  5. 2 What is Functional Programming?
    1. 2.1 Let’s See Some Code
    2. 2.2 History
    3. 2.3 Other Functional Implementations
    4. 2.4 Commercial Uses
    5. 2.5 What is Functional Programming Best for?
    6. 2.6 The Benefits of Functional Programming
    7. 2.7 Functional Basics
  6. 3 Language Features
    1. 3.1 Types
    2. 3.2 Functions
    3. 3.3 Namespacing
    4. 3.4 Recursion
    5. 3.5 Map, Reduce, and Filter
    6. 3.6 Memoization
    7. 3.7 Generators
  7. 4 Helpful Libraries
    1. 4.1 Library Installation
    2. 4.2 The iter Library
  8. 5 HHVM’s Hack
    1. 5.1 Types
    2. 5.2 Lambda Expressions
    3. 5.3 Special (Magical) Attributes
    4. 5.4 Conclusion
  9. 6 Patterns
    1. 6.1 Head and Tail
    2. 6.2 Flattening lists
    3. 6.3 Handling Your NULLS
    4. 6.4 Composition
    5. 6.5 Partial Functions
    6. 6.6 Pipelines
    7. 6.7 Pattern Matching
    8. 6.8 Functors
    9. 6.9 Applicatives
    10. 6.10 Monads
  10. 7 Implementing the Theory
    1. 7.1 IP Address Restriction
    2. 7.2 Functional Primitives
    3. 7.3 A Domain Specific Language in PHP
  11. 8 Event Driven Programming
    1. 8.1 ReactPHP Installation
    2. 8.2 Getting Started
    3. 8.3 Add Some Logging
    4. 8.4 Introduce a Monad
    5. 8.5 Callback Wrangling
    6. 8.6 Wrap Up the Show
  12. 9 Hazards of Functional Programming in PHP
  13. 10 Advances in PHP
    1. 10.1 PHP 5.4
    2. 10.2 PHP 5.5
    3. 10.3 PHP 5.6
    4. 10.4 PHP 7
    5. 10.5 Further into the Future
  14. 11 Conclusion
  15. Appendix A: Additional Notes
    1. 11.1 Understanding Type Signatures
    2. 11.2 Using the UTF-8 Ellipsis
  16. 12 Appendix B: Resources
    1. 12.1 PHP REPLs
    2. 12.2 Libraries
    3. 12.3 Other Functional Implementations
    4. 12.4 Online Courses (MOOC)
  17. Glossary
  18. Credits