// Check number---regular or irregular
//This is first file------- num.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>check Numbers</title>
</head>
<body>
<form action="number.php" method="post">
Please input six number=<input type="text" id="num" name="num"/><br/>
<input type="submit" id="submit" name="submit"/>
</form>
</body>
</html>
//This is Second file------ number.php
<?php
$num=$_POST["num"];
for($i=0; $i<6; $i++)
{
if($num[$i]==($num[$i+1]-1))
{
$flag=$flag+1;
if($flag==5)
{
echo "Number is regular". "<br/>";
}
}
else if(($num[$i]-1)==$num[$i+1])
{
$flag1=$flag1+1;
if($flag1==5)
{
echo "Number is regular". "<br/>";
}
}
}
if($flag<5 && $flag1<5)
{
echo "Number is irregular". "<br/>";
}
?>