Sadly there is no overload in PHP as it is done in C#. But i have a little trick. I declare arguments with default null values and check them in a function. That way my function can do different things depending on arguments. Below is simple example:
public function query($queryString, $class = null) //second arg. is optional
{
$query = $this->dbLink->prepare($queryString);
$query->execute();
//if there is second argument method does different thing
if (!is_null($class)) {
$query->setFetchMode(PDO::FETCH_CLASS, $class);
}
return $query->fetchAll();
}
//This loads rows in to array of class
$Result = $this->query($queryString, "SomeClass");
//This loads rows as standard arrays
$Result = $this->query($queryString);