构造函数的最佳方法是什么,参数可以为null?
例如
function newDate($day, $time = null, $overRide) {
Do something with the variables
}
# newDate('12', '', 'yes');
Run Code Online (Sandbox Code Playgroud)
是否只需按如下方式重构功能:
function newDate($day, $overRide, $time = null) {
Do something with the variables
}
# newDate('12', 'yes');
Run Code Online (Sandbox Code Playgroud)