EVEN ODD Number is a formula of an integer value. Today I am going to discuss with you about how to use and create web application using EVEN ODD Number In PHP
What is EVEN Number?
EVEN number is an integer which is evenly divisible by two. If you divide the integer by two and if it has no remainder after divided then the number is EVEN number.
What is ODD Number?
ODD number is an integer which is not divisible by two. If you divide the integer then you will get a remainder. then the number is ODD number.
In this tutorial, I am going to show you about even odd in PHP. how to detect a number even or odd? you can detect a number even or odd using simple PHP math calculation. Let's see the calculation,
<?php
$number = 12;
switch ($number%2)
{
case 0:
echo 'EVEN Number';
break;
default:
echo 'ODD Number';
}
?>
// Ourput EVEN Number
and if you run this code,
<?php
$number = 15;
switch ($number%2)
{
case 0:
echo 'EVEN Number';
break;
default:
echo 'ODD Number';
}
?>
Now it will execute, ODD Number.Now we are going to make a game for kids using this function. create a file name index.php and write down this code into index.php file,
<?php
if (isset($_POST['start'])&&$_POST['start']==1)
{
$ans = $_POST['answer'];
$number = $_POST['number'];
switch ($number%2)
{
case 0:
$value = 2;
$correct ="EVEN Number";
break;
default:
$value = 1;
$correct ="ODD Number";
}
if($ans==$value)
{
echo 'You are correct! this is '.$correct;
}
else
{
echo 'You are wrong! this is '.$correct;
}
$number = rand(100,10000);
echo '<b>'.$number.'</b>';
echo '<br/><b>What is the number?</b><br/>';
echo '<form method="post">';
echo '<input type="radio" name="answer" value="1" required> ODD Number<br/>';
echo '<input type="radio" name="answer" value="2" required> EVEN Number<br/><br/>';
echo '<input type="hidden" name="start" value="1">';
echo '<input type="hidden" name="number" value="'.$number.'">';
echo '<input type="submit" value="Submit">';
echo '</form>';
?>
If you run this script then you will see a random number and two option EVEN number & ODD Number select any option and click to submit then you will show a result. 
I will upload this script into this article you can download and add a style of this script as you like.
If you have any question about this article please comment here and if you like this article please share this with others.