PHP Comparison Confusion

// today is 03 Jan 2009
$datemonth = (int) date("md");

if($datemonth == 0103){
    echo "Match";
} else {
    echo "Not a match";
}

I get Not a matchas a result. Is 0103 not 103 when compared as a whole? In this situation, I can use if($datemonth == 103)for the intended behavior. But why does logic fail? The leading zero does not matter in integers, right?

+3
source share
1 answer

, , ( 8). , ( 10) . 0103 67 . , . . PHP .

+9

Source: https://habr.com/ru/post/1727127/


All Articles