adamhhh Posted March 14, 2007 Share Posted March 14, 2007 if if ($start_year % 4 != 0 etc... so im trying to look to see if the start year isnt divided by 4 (it works for when it is). But this statement doesnt work and i cant figure out why?? Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/ Share on other sites More sharing options...
mbtaylor Posted March 14, 2007 Share Posted March 14, 2007 if ($start_year % 4 == 0) { # the year is divisible by 4 }else{ # the year is not divisible by 4 } != 0 should work fine too (the opposite obviously). Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/#findComment-206923 Share on other sites More sharing options...
adamhhh Posted March 14, 2007 Author Share Posted March 14, 2007 it should but it doesnt ignore the double if by the way. Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/#findComment-206927 Share on other sites More sharing options...
mbtaylor Posted March 14, 2007 Share Posted March 14, 2007 Odd, only thing I can think is if its looking for false? 1=true, 0=false etc. Maybe the triple equal would sort that !== that does type check too I believe. Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/#findComment-206929 Share on other sites More sharing options...
adamhhh Posted March 14, 2007 Author Share Posted March 14, 2007 nope tried that too ??? Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/#findComment-206948 Share on other sites More sharing options...
mbtaylor Posted March 14, 2007 Share Posted March 14, 2007 bugger knows then lol maybe someone else will enlighten us! Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/#findComment-206981 Share on other sites More sharing options...
kenrbnsn Posted March 14, 2007 Share Posted March 14, 2007 This code <?php $start_year = date('Y')+1; if ($start_year % 4 == 0) { echo "ok"; }else{ echo "not ok"; } ?> works fine for me. Please show us your value of "$start_year" and why you're saying it doesn't work. Ken Link to comment https://forums.phpfreaks.com/topic/42651-whats-wrong-with-this-statement/#findComment-206996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.