構造函數的最佳方式是什麼?函數的參數可以爲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