Check if is even or is odd in PHP

0.33K views
no comments
13 Sep 2014 8:23 pm

FUNCTION TO CHECK IF IS EVEN NUMBER

[php]
function is_even($number=null){
return(!($number & 1));
}
<pre>
[/php]

FUNCTION TO CHECK IF IS ODD NUMBER

[php]
function is_odd($number=null){
return($number & 1);
}
[/php]

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>