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.


Copy this code and paste it in your HTML
  1. function is_odd( $num ){
  2. return(is_numeric($num)&($num&1));
  3. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.