PHP supports object oriented constructs in newer versions, but function overloading is not part of the object oriented paradigm.
As already said by someone else, PHP does not support overloading functions. In PHP you can define "default values" for function parameters. Your function could look like this, with your expected behaviour:
function clsUsagerEmailUserName($nickName, $email = NULL)
{
if ($email <> NULL)
{
$this->nickName = $nickName;
$this->email = $eMail;
}
else
{
$this->email = $nickName;
}
}
Note the confusion with the variable names in the example above! A better use of this "feature" in PHP would look like this, but you would need to update each function call in you application:
function clsUsagerEmailUserName($email, $nickName = NULL)
{
$this->email = $email;
if ($nickName <> NULL)
$this->nickName = $nickName;
}
For clean-ness i would prefer the second one.