TheBlackBenzKid
TheBlackBenzKid

Reputation: 27087

PHP Today echo Tomorrow echo something else

This code does not work. It echo is blank. PHP version: PHP Version 5.0.5

$today=(int)date("j");  # today
$statedate=12;
if ((int)$startdate == (int)$today){
    echo '12th';
}
if ((int)$startdate == (int)$today){
    echo '14th';
}

Upvotes: 0

Views: 267

Answers (2)

adudley
adudley

Reputation: 944

sure (int)$today will give you something like the number of days past 1970? I would suggest you first of all simply write

echo '' . (int)$today; 

to see what the value is, then you will know how to write the if statement.

Upvotes: -2

Naftali
Naftali

Reputation: 146302

$today=(int)date("j");  # today
$statedate=12; //NEVER USED!
if ((int)$startdate == (int)$today){
    echo '12th';
}
if ((int)$startdate == (int)$today){
    echo '14th';
}

You are defining $statedate and not $startdate

Upvotes: 5

Related Questions