Here is simple PHP code snippet to check if a given number is odd or even.
Check Number Is Odd Or Even
1 2 3 |
function checkEven($val){ return ($val%2 == 0); } |
How to use checkEven
1 2 3 4 5 6 |
$val = 7; if(checkEven($val)){ 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.
Subscribe
Login
0 Comments