How can I make an optional argument in my custom function in PHP?

Viewed 9644

For example, here's a quick dummy function that sums it up:

function dummy_func($optional)
{
    if (!isset($optional)
    {
        $optional = "World!";
    }
    $output = "Hello " . $optional;
    return $output;
}

However, if I run this, I get an E_WARNING for a missing argument. How can I set it up so it doesn't flag an error?

2 Answers
Related