PHP allows us to define optional parameters for functions by providing a default value for those parameters. It is a useful technique if we know that we will be using the default value the majority of the time. By making it optional we save ourselves the effort of providing that value, except for the rare times we need to use something different than the default. And if we ever need to change that default value we only need to modify the function definition, not every single place we call the function.
But PHP allows us to write optional parameters in an ‘incorrect’ way, which is what we’ll look at today.
View original post 635 more words