How can you modify a PHP function to make a parameter optional and not mandatory?

To make a parameter optional in a PHP function, you can assign a default value to the parameter in the function definition. This way, if the parameter is not provided when calling the function, it will use the default value instead. This allows for more flexibility in function usage without requiring all parameters to be provided.

function exampleFunction($param1, $param2 = 'default') {
    // Function code here
}