pereira2k5 Posted March 19, 2008 Share Posted March 19, 2008 You can determine if a year is a leap year by testing if it is divisble by 4 howver, years that are also divisible by 100 are not leap years unless there divisible by 40. I know that you have to do if and the condition and && and || and stuff like that, the only question is how do I determine if something is divisible by something else? if ( YEAR / 4 == "true" echo " This is a leap Year ... Is something like that correct I dont understand how to test to see if something is divisible... Thanks guys Link to comment https://forums.phpfreaks.com/topic/96831-easy-question-for-you-guys-i-really-need-help/ Share on other sites More sharing options...
Jeremysr Posted March 19, 2008 Share Posted March 19, 2008 Use the modulus operator, the percent sign (%). It divides the first operand by the second operand and returns the remainder. So if x % y is 0, that means x is divisible by y. Link to comment https://forums.phpfreaks.com/topic/96831-easy-question-for-you-guys-i-really-need-help/#findComment-495529 Share on other sites More sharing options...
rofl90 Posted March 19, 2008 Share Posted March 19, 2008 or you could test for a . in the answer, if there is you know its not. Link to comment https://forums.phpfreaks.com/topic/96831-easy-question-for-you-guys-i-really-need-help/#findComment-495538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.