All Classes Namespaces Functions Variables Groups Pages
Overloading

Functions and methods can be overloaded if parameter types are declared as in the following example:

int sub example(int $i) {
printf("i=%d\n", $i);
return $i + 1;
}
string sub example(string $str) {
printf("str=%s\n", $str);
return $str + "foo";
}

In this case, the first version (`example(int)`) will be executed if called with an integer argument, and the second (`example(string)`) if called with a string argument.

Class methods may also be overloaded, but note that destructor(), copy(), methodGate(), memberGate(), and memberNotification() methods may not be overloaded (see Classes for more information).