构造函数的最佳方式是什么?函数的参数可以为null?PHP函数定义,空参数
如
function newDate($day, $time = null, $overRide) {
Do something with the variables
}
# newDate('12', '', 'yes');
难道是简单地重组功能如下:
function newDate($day, $overRide, $time = null) {
Do something with the variables
}
# newDate('12', 'yes');
这不是风格问题,而是语言支持问题。 PHP仅支持参数列表末尾的可选参数。 – pgb 2010-02-15 18:18:17