whats wrong with this?

From: Date: Wed, 28 Aug 2002 16:12:18 +0000
Subject: whats wrong with this?
Groups: php.general 
Request: Send a blank email to php-general+get-114379@lists.php.net to get a copy of this message
I just cant seem to work out why this doesn't work. My PHP book doesn't explain "if" statements very well so i have no idea if i am breaking a rule. $system_day = date("j"); for($day = 1; $day < 32; $day++){ if($day = $system_day){ echo "match!"; } else{ echo "no match"; } } the problem i am experiencing is that it seems the "if" statement is setting the $day value to equal $system_day instead of comparing their values.... if i add echo "Day: " . $day . " System_day: " . $system_day; before and after the if statement then the first result is something like Day: 1 System_day: 29 after the "if" statement has executed the result is Day: 29 System_day: 29 so you see, instead of "if" comparing $day to $system_day it is making $day equal to $system_day. any ideas why and how to fix this? help is most appreciated :)

« previous php.general (#114379) next »