Reuse function with variables missing

Is there a way to reuse a function but not pass the same variables each time.
For example.

The function
[php]function getRandomPerson($boardpoint,$task,$n) {[/php]

Gets $n sent to it when I want to setFastpost
[php] function setFastpost($boardpoint,$task) {
for ($n=1; $n< 4; $n++) {
$this->getRandomPerson($boardpoint,$task,$n);
}
return true;
}[/php]

But when I want to setBCMSweeper $n isn’t needed, but I still have to send an empty $n value through. Otherwise I get an error.

[php] function setBCMSweeper($boardpoint,$task) {
$n=0;
$this->getRandomPerson($boardpoint,$task,$n);
return true;
}[/php]

How do I make it so that getRandomPerson still functions fine and ignores $n if it isn’t set?

Turns out you have to do $n=NULL
[php] function setBCMSweeper($boardpoint,$task) {
$this->getRandomPerson($boardpoint,$task,$n=NULL);
return true;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service