> That won't work.  % returns the remainder from a division of 
> the number divided by the mod number.

Yours:

> if($num %2 == 0){
> echo "even";
> }else{
> echo "odd";
> }

Mine:

> > if( $num % 2 ) {
> >   echo "Odd";
> >
> > } else {
> >   echo "Even";
> >
> > }

Ours are identical, just the other way around.  This:

if( $num % 2 ) {  

means if the result of that operation is anything other than
0 (zero), which is a truth in PHP.

Chris

Reply via email to