PHP – How To Check Number Is Odd Or Even

Here is simple PHP code snippet to check if a given number is odd or even.

Check Number Is Odd Or Even

function checkEven($val){
     return ($val%2 == 0);

How to use checkEven

$val = 7;
    echo "Number is even";
} else {
    echo "Number is odd";

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems. Protection Status