How can you define default values for parameters in a PHP function?

In PHP, you can define default values for parameters in a function by assigning a default value to the parameter in the function definition. This allows you to call the function without providing a value for that parameter, and it will use the default value instead. This is useful when you want to make certain parameters optional in a function.

function greet($name = "Guest") {
    echo "Hello, $name!";
}

// Calling the function without providing a value for $name will use the default value "Guest"
greet(); // Output: Hello, Guest!

// Calling the function with a value for $name will override the default value
greet("John"); // Output: Hello, John!