What are best practices for handling optional parameters in PHP functions to avoid unexpected behavior?

When handling optional parameters in PHP functions, it is best practice to provide default values for these parameters to avoid unexpected behavior. This ensures that the function will work correctly even if the optional parameters are not explicitly passed when calling the function.

function exampleFunction($requiredParam, $optionalParam = 'default value') {
    // function code here
}