What are the best practices for setting default values in PHP function parameters to avoid limitations in functionality?

When setting default values in PHP function parameters, it's important to consider the potential limitations it may introduce in terms of functionality. To avoid these limitations, it's best to use null as the default value for parameters that should be optional, and then check for null within the function to handle the default behavior. This approach allows for more flexibility and avoids potential conflicts with other default values.

function exampleFunction($param1, $param2 = null) {
    if ($param2 === null) {
        // Handle default behavior for $param2
    }
    
    // Rest of the function logic
}