What are the advantages and disadvantages of using null as a placeholder value for default parameters in PHP functions compared to using empty checks?

Using null as a placeholder value for default parameters in PHP functions can make the code cleaner and more readable compared to using empty checks. However, it may lead to potential bugs if the function expects null as a valid argument. On the other hand, using empty checks allows for more flexibility and control over the default parameter value, but it can make the code more verbose.

// Using null as a placeholder value for default parameters
function greet($name = null) {
    if ($name === null) {
        $name = "Guest";
    }
    echo "Hello, $name!";
}

greet(); // Output: Hello, Guest!

// Using empty checks for default parameters
function greet($name = "") {
    if (empty($name)) {
        $name = "Guest";
    }
    echo "Hello, $name!";
}

greet(); // Output: Hello, Guest!