Posted By

leond on 11/02/10


Tagged

String integer odd even


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

leond


Check if int or string variable is odd


 / Published in: PHP
 

Checks if a integer or string variable contains odd number. Returns true on odd and false on even.

  1. function is_odd( $num ){
  2. return(is_numeric($num)&($num&1));
  3. }

Report this snippet  

You need to login to post a comment.