> Cool ...
> Now that we're talking about PHP ....
> I'd like to ask a question ....
> You know the "overloading" function in C++ .... Is that
> possible in PHP ?
No, I do not believe so.
> Basically , I'd like to define more than one function having
> the same name but different number of variables/parameters ...
> so PHP would know which one I'm calling depending on the
> numbwer/type of the variables ... exemple :
You can do this with variable parameters. Something along
these lines:
function myFunc( $requiredVar, $optionalVar1 = "", $optionalVar2 = "" ) {
echo "$requiredVar<br>\n";
if( $optionalVar1 ) {
echo "$optionalVar1<br>\n";
}
// etc.
}
Alternately, if you need *alot* of optional vars, consider passing
an array and check that.
Chris