someguy321 Posted November 15, 2010 Share Posted November 15, 2010 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]" ); Link to comment https://forums.phpfreaks.com/topic/218773-how-pass-empty-or-nothing-to-a-default-parameter-for-a-function/ Share on other sites More sharing options...
mikosiko Posted November 15, 2010 Share Posted November 15, 2010 Examples #3 and #4... pay special attention to note before example #5 and then #6 http://php.net/manual/en/functions.arguments.php Link to comment https://forums.phpfreaks.com/topic/218773-how-pass-empty-or-nothing-to-a-default-parameter-for-a-function/#findComment-1134651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.