Just like most languages you can use PHP to do Arithmetic equations like so:
echo (10 / 2);//5 echo (10 + 2);//12 echo (10 * 2);//20 echo (10 - 2);//8 echo (10 % 2);//0 $value = 50; $value2 = 10; echo ($value * $value2);//500 echo ($value - ($value + $value2));//10
To check if a value or variable is even use:
if (($var % 2) == 1) { echo "$var is odd." ;} if (($a % 2) == 0) { echo "$var is even." ;}
To alternate a script output:
for ($i = 1; $i <= 10; $i++) { if(($i % 2) == 1) {echo "<h1>$i is Even</h1>";} else {echo "<h1>$i is Odd</h1>";} }