From the course: Functional Programming with PHP
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Property getter - PHP Tutorial
From the course: Functional Programming with PHP
Challenge: Property getter
(upbeat music) - [Instructor] Before we wrap up this course, we're going to go through a few functional programming challenges that'll help you get more familiar with the functional paradigm and hopefully learn a few more tricks along the way. The first challenge we're going to look at has to do with partial application, one of the more advanced concepts we saw in a previous sections. So let's imagine that in a certain program we've created a function called get_property which we can use to get the value of a certain key from an array if we're not sure the array has that key and set a default value to return if it turns out the array doesn't have that key. So for example if we have an array representing a person's data and we wanted to get the value of their favorite color key which they may or may not have we could say get_property favorite_color set a default value of none and call it on person. And assign…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.