如何实现可以接受不同数量参数的php构造函数?
喜欢
class Person {
function __construct() {
// some fancy implementation
}
}
$a = new Person('John');
$b = new Person('Jane', 'Doe');
$c = new Person('John', 'Doe', '25');
Run Code Online (Sandbox Code Playgroud)
在php中实现这个的最佳方法是什么?
谢谢,米洛