我在命名函數時遇到了問題。我有一個課,我需要2個功能,如下所示。PHP類函數命名
class myclass {
public function tempclass() {
echo "default";
}
public function tempclass ($text) {
echo $text;
}
}
當我打電話
tempclass('testing'); // (called after creating the object)
function tempclass()
被稱爲我怎麼能有2個功能具有相同名稱但不同的參數?
爲什麼使用報價格式,而不是代碼格式化您的代碼? – ThiefMaster 2012-04-20 15:21:38
@ThiefMaster哎呀,我的壞。 – 2012-04-20 15:34:48