You learned about loops early in your programming career and use them every day--so often you don't think twice! The problem is for() and foreach() are so fundamental developers use them for everything! Even worse almost every developer uses them differently to accomplish the same goal. So what would intention-revealing, expressive PHP code look like without using for() and foreach()?
Let's explore some functional programming concepts and find out! Knowing basic functional programming concepts will improve your PHP code. Your new mindset will favor writing code with better separation of concerns and decreased complexity: clean code.
We'll explore poor examples of using loops to process data, then ease into learning functional concepts like map, reduce, filter and collection pipelining. We'll even use our newfound knowledge to refactor those bad loops. Lastly we'll explore some existing libraries and even experimental PHP RFC features to make our code even more concise.
Beware: after this talk you'll never look at for() and foreach() loops the same again!About the speaker
John has been a professional developer since 1998 and using PHP for over 12 years. He currently works remotely as a software developer serving clients in biomedical research, higher education and transportation industries. He calls Lawrence, Kansas home (Rock Chalk!) and is a co-organizer of the Kansas City PHP User Group and Lawrence Coders.