Backend and Infrastructure

Optional PHP Function Arguments

Sprout Video

In this tutorial we're going to add our $limit variable as an optional argument to our get_pets() function. We're using this variable in our if statement, and we're going to look at different ways to supply "true" and "false" using data other than booleans. This allows you to pass in a value and still evaluate true/false. PHP has some conventions for what is true or not, and it's a good idea to understand what these are.