Check if is even or is odd in PHP

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

FUNCTION TO CHECK IF IS EVEN NUMBER

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

FUNCTION TO CHECK IF IS ODD NUMBER

function is_odd($number=null){
	return($number & 1);
}

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>