Click here to Skip to main content
15,917,060 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I made this calendar in PHP and need to bold all even numbers how do I do that? I am very new to php. Thanks
Posted

1 solution

It's like this to detect for odd or even numbers:

PHP
$test = a$ % 2 == 0; //Modulo by 2 equals zero means it's even
$test = a$ % 2 == 1; //Modulo by 2 euqals to one means it is odd


Please look here also: http://php.net/manual/de/language.operators.arithmetic.php[^]

Regards,
Manfred
 
Share this answer
 
v3
Comments
Member 7666290 13-Feb-11 23:19pm    
Ok I did find that on there thanks for the information. But how do I get it to bold the even numbers after it finds the even numbers?
Manfred Rudolf Bihy 14-Feb-11 6:26am    
If you're generating HTML output just put the numbers you want to have boldened in a <b> tag: <b>$evenNumber</b>. That's all.
fjdiewornncalwe 17-Feb-11 9:23am    
+5. Simple, clear and correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900