You have to implement the constructor once and use func_get_args and func_num_args like this:
<?php
class myclass {
function __construct() {
$args = func_get_args();
switch (func_num_args()) {
case 1:
var_dump($args[0]);
break;
case 2:
var_dump($args[0], $args[1]);
break;
default:
throw new Exception("Wrong number of arguments passed to the constructor of myclass");
}
}
}
new myclass(123); //> call the first construct
new myclass(123,'abc'); //> call the second
new myclass(123,'abc','xyz'); //> will throw an exception
This way you can support any number of arguments.