3
// today is 03 Jan 2009
$datemonth = (int) date("md");
if($datemonth == 0103){
echo "Match";
} else {
echo "Not a match";
}
我收到Not a match
作爲結果。當比較爲整數時,0103是否等於103?在這種情況下,我可以使用if($datemonth == 103)
來達到預期的行爲。但爲什麼邏輯失敗?前導零在整數中沒有任何值,對嗎?PHP比較混淆
+1嘿,這總是讓我。接得好。 – cletus
+1該死的八卦! – missingfaktor
謝謝!這絕對是我的! – Nirmal