Jump to content

How pass empty or nothing to a default parameter for a function?


someguy321

Recommended Posts

If I have a parameter that has a default value, how do I pass nothing such that it uses the default value? Passing NULL does not work.

 

function test($to = "[email protected]", $from)
{
echo $to . "<BR>" . $from;
}

//This will NOT show "[email protected]" but instead an empty line
test( NULL, "[email protected]" );

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.