<?php

$_SESSION['amt']=$amt;
$rupees=$amt;
$rupees=bcdiv($rupees,1,2);
$length1=strlen($rupees);
$length=$length1-3;
$amount=substr($rupees,0,$length);
$amount1=substr($rupees,0,$length-1);

class sum{
         // ----------------for 1 digit(start)--------
		//--------------- for(0-9)
		function first()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			if($amount==0){$text="Zero";}
			if($amount==1){$text="One";}
			if($amount==2){$text="Two";}
			if($amount==3){$text="Three";}
			if($amount==4){$text="Four";}
			if($amount==5){$text="Five";}
			if($amount==6){$text="Six";}
			if($amount==7){$text="Seven";}
			if($amount==8){$text="Eight";}
			if($amount==9){$text="Nine";}
		  echo $text;
		}
		//-------------------------------for 1 digit(end)---------
		//-------------------------------for 2 digit(start)-------
		//--------------- for(10,20,30,40,50,60,70,80,90)
		function second1()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,1,$length-1);
			if($amount1==0)
			{
				$amount2=substr($rupees,0,$length-1);
				if($amount2==1){$text="Ten";}
				if($amount2==2){$text="Twenty";}
				if($amount2==3){$text="Thirty";}
				if($amount2==4){$text="Fourty";}
				if($amount2==5){$text="Fifty";}
				if($amount2==6){$text="Sixty";}
				if($amount2==7){$text="Seventy";}
				if($amount2==8){$text="Eighty";}
				if($amount2==9){$text="Ninety";}
			}
		   print $text;
		}
		//--------------- for(21-99)
		function second2()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,1,$length-1);
			if($amount1!=0&&$amount!=11&&$amount!=12&&$amount!=13&&$amount!=14&&$amount!=15&&$amount!=16&&$amount!=17&&$amount!=18&&$amount!=19)
			{
				$amount2=substr($rupees,0,$length-1);
				if($amount2==2){$text="Twenty";}
				if($amount2==3){$text="Thirty";}
				if($amount2==4){$text="Fourty";}
				if($amount2==5){$text="Fifty";}
				if($amount2==6){$text="Sixty";}
				if($amount2==7){$text="Seventy";}
				if($amount2==8){$text="Eighty";}
				if($amount2==9){$text="Ninety";}
				if($amount1==1){$text1="One";}
				if($amount1==2){$text1="Two";}
				if($amount1==3){$text1="Three";}
				if($amount1==4){$text1="Four";}
				if($amount1==5){$text1="Five";}
				if($amount1==6){$text1="Six";}
				if($amount1==7){$text1="Seven";}
				if($amount1==8){$text1="Eight";}
				if($amount1==9){$text1="Nine";}
			}
			if($amount1!=0)
			{
				if($amount==11){$text="Eleven";}
				if($amount==12){$text= "Twelve";}
				if($amount==13){$text="Thirteen";}
				if($amount==14){$text="Fourteen";}
				if($amount==15){$text="Fifteen";}
				if($amount==16){$text="Sixteen";}
				if($amount==17){$text="Seventeen";}
				if($amount==18){$text="Eighteen";}
				if($amount==19){$text="Nineteen";}
			}
		  print $text." ".$text1;
		}
		//-------------------------------for 2 digit(end)-------
		//-------------------------------for 3 digit(start)-------
		//----------for(100,200,300,400,500,600,700,800,900)-------
		function third()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,0,$length-1);
			$amount3=substr($rupees,1,$length-1);
			
				$amount2=substr($rupees,0,$length-2);
				if($amount2==1){$text="One Hundred";}
				if($amount2==2){$text="Two Hundred";}
				if($amount2==3){$text="Three Hundred";}
				if($amount2==4){$text="Four Hundred";}
				if($amount2==5){$text="Five Hundred";}
				if($amount2==6){$text="Six Hundred";}
				if($amount2==7){$text="Seven Hundred";}
				if($amount2==8){$text="Eight Hundred";}
				if($amount2==9){$text="Nine Hundred";}
			
		  print $text;
		}
		//------------------for(101-999)---------------
		function third1()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,0,$length-1);
			$amount3=substr($rupees,1,$length-1);
				$amount2=substr($rupees,0,$length-2);
				$amount4=substr($amount3,1,$length-1);
				$length5=strlen($amount3);
				$amount5=substr($amount3,0,$length5-1);
				if($amount4==0)
				{
					if($amount5==1){$text1="Ten";}
					if($amount5==2){$text1="Twenty";}
					if($amount5==3){$text1="Thirty";}
					if($amount5==4){$text1="Fourty";}
					if($amount5==5){$text1="Fifty";}
					if($amount5==6){$text1="Sixty";}
					if($amount5==7){$text1="Seventy";}
					if($amount5==8){$text1="Eighty";}
					if($amount5==9){$text1="Ninety";}
				}
				$amount6=substr($rupees,2,$length-2);
				$amount7=substr($rupees,1,$length-1);
				if($amount4!=0&&$amount7!=11&&$amount7!=12&&$amount7!=13&&$amount7!=14&&$amount7!=15&&$amount7!=16&&$amount7!=17&&$amount7!=18&&$amount7!=19)
				{
					if($amount5==2){$text1="Twenty";}
					if($amount5==3){$text1="Thirty";}
					if($amount5==4){$text1="Fourty";}
					if($amount5==5){$text1="Fifty";}
					if($amount5==6){$text1="Sixty";}
					if($amount5==7){$text1="Seventy";}
					if($amount5==8){$text1="Eighty";}
					if($amount5==9){$text1="Ninety";}
					if($amount6==1){$text2="One";}
					if($amount6==2){$text2="Two";}
					if($amount6==3){$text2="Three";}
					if($amount6==4){$text2="Four";}
					if($amount6==5){$text2="Five";}
					if($amount6==6){$text2="Six";}
					if($amount6==7){$text2="Seven";}
					if($amount6==8){$text2="Eight";}
					if($amount6==9){$text2="Nine";}
				}
				if($amount4!=0)
				{
					if($amount7==11){$text1="Eleven";}
					if($amount7==12){$text1= "Twelve";}
					if($amount7==13){$text1="Thirteen";}
					if($amount7==14){$text1="Fourteen";}
					if($amount7==15){$text1="Fifteen";}
					if($amount7==16){$text1="Sixteen";}
					if($amount7==17){$text1="Seventeen";}
					if($amount7==18){$text1="Eighteen";}
					if($amount7==19){$text1="Nineteen";}
				}
			
		  echo $text." ".$text1." ".$text2;
		}
		//-------------------------------for 3 digit(end)-------
		//-------------------------------for 4 digit(start)-------
		function fourth()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,0,$length-1);
			$amount3=substr($rupees,1,$length-1);
			$amount2=substr($rupees,0,$length-3);
			
				if($amount2==1){$text="One Thousand";}
				if($amount2==2){$text="Two Thousand";}
				if($amount2==3){$text="Three Thousand";}
				if($amount2==4){$text="Four Thousand";}
				if($amount2==5){$text="Five Thousand";}
				if($amount2==6){$text="Six Thousand";}
				if($amount2==7){$text="Seven Thousand";}
				if($amount2==8){$text="Eight Thousand";}
				if($amount2==9){$text="Nine Thousand";}
			
		  echo $text." ";
		}
		function fourth1()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,0,$length-1);
			$amount3=substr($rupees,1,$length-1);
			$amount2=substr($rupees,0,$length-3);
			$amount4=substr($rupees,2,$length-2);
			$amount5=substr($rupees,1,$length-3);
			$amount7=substr($rupees,2,$length-3);
			$amount9=substr($rupees,2,$length-2);
				if($amount5==1){$text1="One Hundred";}
				if($amount5==2){$text1="Two Hundred";}
				if($amount5==3){$text1="Three Hundred";}
				if($amount5==4){$text1="Four Hundred";}
				if($amount5==5){$text1="Five Hundred";}
				if($amount5==6){$text1="Six Hundred";}
				if($amount5==7){$text1="Seven Hundred";}
				if($amount5==8){$text1="Eight Hundred";}
				if($amount5==9){$text1="Nine Hundred";}
				$amount6=substr($rupees,3,$length-3);
				if($amount6==0)
				{
					if($amount7==1){$text2="Ten";}
					if($amount7==2){$text2="Twenty";}
					if($amount7==3){$text2="Thirty";}
					if($amount7==4){$text2="Fourty";}
					if($amount7==5){$text2="Fifty";}
					if($amount7==6){$text2="Sixty";}
					if($amount7==7){$text2="Seventy";}
					if($amount7==8){$text2="Eighty";}
					if($amount7==9){$text2="Ninety";}
				}
				if($amount6!=0&&$amount9!=11&&$amount9!=12&&$amount9!=13&&$amount9!=14&&$amount9!=15&&$amount9!=16&&$amount9!=17&&$amount9!=18&&$amount9!=19)
				{
					if($amount7==1){$text2="Ten";}
					if($amount7==2){$text2="Twenty";}
					if($amount7==3){$text2="Thirty";}
					if($amount7==4){$text2="Fourty";}
					if($amount7==5){$text2="Fifty";}
					if($amount7==6){$text2="Sixty";}
					if($amount7==7){$text2="Seventy";}
					if($amount7==8){$text2="Eighty";}
					if($amount7==9){$text2="Ninety";}
					$amount8=substr($rupees,3,$length-3);
					if($amount8==1){$text3="One";}
					if($amount8==2){$text3="Two";}
					if($amount8==3){$text3="Three";}
					if($amount8==4){$text3="Four";}
					if($amount8==5){$text3="Five";}
					if($amount8==6){$text3="Six";}
					if($amount8==7){$text3="Seven";}
					if($amount8==8){$text3="Eight";}
					if($amount8==9){$text3="Nine";}
				}
				if($amount6!=0)
				{
					if($amount9==11){$text4="Eleven";}
					if($amount9==12){$text4= "Twelve";}
					if($amount9==13){$text4="Thirteen";}
					if($amount9==14){$text4="Fourteen";}
					if($amount9==15){$text4="Fifteen";}
					if($amount9==16){$text4="Sixteen";}
					if($amount9==17){$text4="Seventeen";}
					if($amount9==18){$text4="Eighteen";}
					if($amount9==19){$text4="Nineteen";}
				}
			
		  echo $text1." ".$text2." ".$text3." ".$text4;
		}
		//-------------------------------for 4 digit(end)-------
		//-------------------------------for 5 digit(start)-------
		function fifth()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount3=substr($rupees,0,$length-3);
			if($amount3==11){$text="Eleven";}
			if($amount3==12){$text= "Twelve";}
			if($amount3==13){$text="Thirteen";}
			if($amount3==14){$text="Fourteen";}
			if($amount3==15){$text="Fifteen";}
			if($amount3==16){$text="Sixteen";}
			if($amount3==17){$text="Seventeen";}
			if($amount3==18){$text="Eighteen";}
			if($amount3==19){$text="Nineteen";}
			$amount4=substr($rupees,1,$length-4);
			$amount5=substr($rupees,0,$length-4);
			if($amount4==0)
			{
				if($amount5==1){$text="Ten";}
				if($amount5==2){$text="Twenty";}
				if($amount5==3){$text="Thirty";}
				if($amount5==4){$text="Fourty";}
				if($amount5==5){$text="Fifty";}
				if($amount5==6){$text="Sixty";}
				if($amount5==7){$text="Seventy";}
				if($amount5==8){$text="Eighty";}
				if($amount5==9){$text="Ninety";}
			}
			if($amount4!=0&&$amount3!=11&&$amount3!=12&&$amount3!=13&&$amount3!=14&&$amount3!=15&&$amount3!=16&&$amount3!=17&&$amount3!=18&&$amount3!=19)
			{
				if($amount5==2){$text="Twenty";}
				if($amount5==3){$text="Thirty";}
				if($amount5==4){$text="Fourty";}
				if($amount5==5){$text="Fifty";}
				if($amount5==6){$text="Sixty";}
				if($amount5==7){$text="Seventy";}
				if($amount5==8){$text="Eighty";}
				if($amount5==9){$text="Ninety";}
				if($amount4==1){$text1="One";}
				if($amount4==2){$text1="Two";}
				if($amount4==3){$text1="Three";}
				if($amount4==4){$text1="Four";}
				if($amount4==5){$text1="Five";}
				if($amount4==6){$text1="Six";}
				if($amount4==7){$text1="Seven";}
				if($amount4==8){$text1="Eight";}
				if($amount4==9){$text1="Nine";}
			}
		  echo $text." ".$text1." "."Thousand"." ";
		}
		function fifth1()
		{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount3=substr($rupees,2,$length-2);//-----------------last three digit--------
			$amount4=substr($rupees,3,$length-3);//-----------------last two digit--------
			$amount5=substr($rupees,2,$length-4);//-----------------the third digit--------
			$amount6=substr($rupees,4,$length-4);//-----------------last digit--------
			$amount7=substr($rupees,3,$length-4);//-----------------the fourth digit--------
			if($amount4==00)
			{
				if($amount5==1){$text="One Hundred";}
				if($amount5==2){$text="Two Hundred";}
				if($amount5==3){$text="Three Hundred";}
				if($amount5==4){$text="Four Hundred";}
				if($amount5==5){$text="Five Hundred";}
				if($amount5==6){$text="Six Hundred";}
				if($amount5==7){$text="Seven Hundred";}
				if($amount5==8){$text="Eight Hundred";}
				if($amount5==9){$text="Nine Hundred";}
			}
			if($amount4!=00)
			{
				if($amount5==1){$text="One Hundred";}
				if($amount5==2){$text="Two Hundred";}
				if($amount5==3){$text="Three Hundred";}
				if($amount5==4){$text="Four Hundred";}
				if($amount5==5){$text="Five Hundred";}
				if($amount5==6){$text="Six Hundred";}
				if($amount5==7){$text="Seven Hundred";}
				if($amount5==8){$text="Eight Hundred";}
				if($amount5==9){$text="Nine Hundred";}
				if($amount6==0)
				{
					if($amount7==1){$text1="Ten";}
					if($amount7==2){$text1="Twenty";}
					if($amount7==3){$text1="Thirty";}
					if($amount7==4){$text1="Fourty";}
					if($amount7==5){$text1="Fifty";}
					if($amount7==6){$text1="Sixty";}
					if($amount7==7){$text1="Seventy";}
					if($amount7==8){$text1="Eighty";}
					if($amount7==9){$text1="Ninety";}
				}
				if($amount6!=0)
				{
					if($amount4==11){$text1="Eleven";}
					if($amount4==12){$text1= "Twelve";}
					if($amount4==13){$text1="Thirteen";}
					if($amount4==14){$text1="Fourteen";}
					if($amount4==15){$text1="Fifteen";}
					if($amount4==16){$text1="Sixteen";}
					if($amount4==17){$text1="Seventeen";}
					if($amount4==18){$text1="Eighteen";}
					if($amount4==19){$text1="Nineteen";}
				}
				if($amount6!=0&&$amount4!=11&&$amount4!=12&&$amount4!=13&&$amount4!=14&&$amount4!=15&&$amount4!=16&&$amount4!=17&&$amount4!=18&&$amount4!=19)
				{
					if($amount7==2){$text1="Twenty";}
					if($amount7==3){$text1="Thirty";}
					if($amount7==4){$text1="Fourty";}
					if($amount7==5){$text1="Fifty";}
					if($amount7==6){$text1="Sixty";}
					if($amount7==7){$text1="Seventy";}
					if($amount7==8){$text1="Eighty";}
					if($amount7==9){$text1="Ninety";}
					if($amount6==1){$text2="One";}
					if($amount6==2){$text2="Two";}
					if($amount6==3){$text2="Three";}
					if($amount6==4){$text2="Four";}
					if($amount6==5){$text2="Five";}
					if($amount6==6){$text2="Six";}
					if($amount6==7){$text2="Seven";}
					if($amount6==8){$text2="Eight";}
					if($amount6==9){$text2="Nine";}
				}
			}
		  echo $text." ".$text1." ".$text2;
		}
		//-------------------------------for 5 digit(end)-------
	   //-------------------------------for 6 digit(start)-------
	   function sixth()
	   {
	   		$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,1,$length);//------------last five digit
			$amount2=substr($rupees,0,$length-5);//-----------------the first digit--------
			$amount3=substr($rupees,1,$length-4);//-----------------the 2&3 digit--------
				    if($amount2==1){$text="One Lac";}
					if($amount2==2){$text="Two Lac";}
					if($amount2==3){$text="Three Lac";}
					if($amount2==4){$text="Four Lac";}
					if($amount2==5){$text="Five Lac";}
					if($amount2==6){$text="Six Lac";}
					if($amount2==7){$text="Seven Lac";}
					if($amount2==8){$text="Eight Lac";}
					if($amount2==9){$text="Nine Lac";} 
		  echo $text;			
	   }
	   
	   function sixth1()
	   {
	   		$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,1,$length);//------------last five digit
			$amount2=substr($rupees,0,$length-5);//-----------------the first digit--------
			$amount3=substr($rupees,1,$length-4);//-----------------the 2nd&3rd digit--------
			$amount4=substr($rupees,1,$length-5);//-----------------the second digit--------
			$amount5=substr($rupees,2,$length-5);//-----------------the third digit--------
			$amount6=substr($rupees,4,$length-4);//------------last two digit
        	$amount7=substr($rupees,3,$length-5);//------------the fourth digit
			$amount8=substr($rupees,5,$length-5);//------------The last digit
			$amount9=substr($rupees,4,$length-5);//------------The fifth digit
			
			 		if($amount3==11){$text1="Eleven Thousand";}
					if($amount3==12){$text1= "Twelve Thousand";}
					if($amount3==13){$text1="Thirteen Thousand";}
					if($amount3==14){$text1="Fourteen Thousand";}
					if($amount3==15){$text1="Fifteen Thousand";}
					if($amount3==16){$text1="Sixteen Thousand";}
					if($amount3==17){$text1="Seventeen Thousand";}
					if($amount3==18){$text1="Eighteen Thousand";}
					if($amount3==19){$text1="Nineteen Thousand";}
					
					if($amount5==0)
					{
						if($amount4==1){$text1="Ten Thousand";}
						if($amount4==2){$text1="Twenty Thousand";}
						if($amount4==3){$text1="Thirty Thousand";}
						if($amount4==4){$text1="Fourty Thousand";}
						if($amount4==5){$text1="Fifty Thousand";}
						if($amount4==6){$text1="Sixty Thousand";}
						if($amount4==7){$text1="Seventy Thousand";}
						if($amount4==8){$text1="Eighty Thousand";}
						if($amount4==9){$text1="Ninety Thousand";}
					}
					if($amount5!=0&&$amount3!=11&&$amount3!=12&&$amount3!=13&&$amount3!=14&&$amount3!=15&&$amount3!=16&&$amount3!=17&&$amount3!=18&&$amount3!=19)
					{
						if($amount4==2){$text1="Twenty";}
						if($amount4==3){$text1="Thirty";}
						if($amount4==4){$text1="Fourty";}
						if($amount4==5){$text1="Fifty";}
						if($amount4==6){$text1="Sixty";}
						if($amount4==7){$text1="Seventy";}
						if($amount4==8){$text1="Eighty";}
						if($amount4==9){$text1="Ninety";}
						if($amount5==1){$text2="One";}
						if($amount5==2){$text2="Two";}
						if($amount5==3){$text2="Three";}
						if($amount5==4){$text2="Four";}
						if($amount5==5){$text2="Five";}
						if($amount5==6){$text2="Six";}
						if($amount5==7){$text2="Seven";}
						if($amount5==8){$text2="Eight";}
						if($amount5==9){$text2="Nine";}
						$text1=$text1." ".$text2." "."Thousand";
					}
					
					if($amoun6==0)
					{
						if($amount7==1){$text3="One Hundred";}
						if($amount7==2){$text3="Two Hundred";}
						if($amount7==3){$text3="Three Hundred";}
						if($amount7==4){$text3="Four Hundred";}
						if($amount7==5){$text3="Five Hundred";}
						if($amount7==6){$text3="Six Hundred";}
						if($amount7==7){$text3="Seven Hundred";}
						if($amount7==8){$text3="Eight Hundred";}
						if($amount7==9){$text3="Nine Hundred";}
					}
					if($amount8==0)
					{
						if($amount9==1){$text4="Ten";}
						if($amount9==2){$text4="Twenty";}
						if($amount9==3){$text4="Thirty";}
						if($amount9==4){$text4="Fourty";}
						if($amount9==5){$text4="Fifty";}
						if($amount9==6){$text4="Sixty";}
						if($amount9==7){$text4="Seventy";}
						if($amount9==8){$text4="Eighty";}
						if($amount9==9){$text4="Ninety";}
					}
					if($amount8!=0)
					{
						if($amount6==11){$text4="Eleven";}
						if($amount6==12){$text4= "Twelve";}
						if($amount6==13){$text4="Thirteen";}
						if($amount6==14){$text4="Fourteen";}
						if($amount6==15){$text4="Fifteen";}
						if($amount6==16){$text4="Sixteen";}
						if($amount6==17){$text4="Seventeen";}
						if($amount6==18){$text4="Eighteen";}
						if($amount6==19){$text4="Nineteen";}
					}
					if($amount8!=0&&$amount6!=11&&$amount6!=12&&$amount6!=13&&$amount6!=14&&$amount6!=15&&$amount6!=16&&$amount6!=17&&$amount6!=18&&$amount6!=19)
					{
						if($amount9==2){$text4="Twenty";}
						if($amount9==3){$text4="Thirty";}
						if($amount9==4){$text4="Fourty";}
						if($amount9==5){$text4="Fifty";}
						if($amount9==6){$text4="Sixty";}
						if($amount9==7){$text4="Seventy";}
						if($amount9==8){$text4="Eighty";}
						if($amount9==9){$text4="Ninety";}
						if($amount8==1){$text5="One";}
						if($amount8==2){$text5="Two";}
						if($amount8==3){$text5="Three";}
						if($amount8==4){$text5="Four";}
						if($amount8==5){$text5="Five";}
						if($amount8==6){$text5="Six";}
						if($amount8==7){$text5="Seven";}
						if($amount8==8){$text5="Eight";}
						if($amount8==9){$text5="Nine";}
					}

		  echo $text." ".$text1." ".$text3." ".$text4." ".$text5;	
	   }
	   //-------------------------------for 6 digit(end)-------
	  //-------------------------------for 7 digit(start)-------
	  function seventh()
	  {
	  		$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,0,$length-5);//----------first two digit------------
			$amount2=substr($rupees,0,$length-6);//----------first digit------------	
            $amount3=substr($rupees,1,$length-6);//----------second digit------------	
	        if($amount1==11){$text="Eleven";}
			if($amount1==12){$text= "Twelve";}
			if($amount1==13){$text="Thirteen";}
			if($amount1==14){$text="Fourteen";}
			if($amount1==15){$text="Fifteen";}
			if($amount1==16){$text="Sixteen";}
			if($amount1==17){$text="Seventeen";}
			if($amount1==18){$text="Eighteen";}
			if($amount1==19){$text="Nineteen";}
			if($amount3==0)
			{
				if($amount2==1){$text="Ten";}
				if($amount2==2){$text="Twenty";}
				if($amount2==3){$text="Thirty";}
				if($amount2==4){$text="Fourty";}
				if($amount2==5){$text="Fifty";}
				if($amount2==6){$text="Sixty";}
				if($amount2==7){$text="Seventy";}
				if($amount2==8){$text="Eighty";}
				if($amount2==9){$text="Ninety";}
			}
			if($amount3!=0&&$amount1!=11&&$amount1!=12&&$amount1!=13&&$amount1!=14&&$amount1!=15&&$amount1!=16&&$amount1!=17&&$amount1!=18&&$amount1!=19)
			{
				if($amount2==2){$text="Twenty";}
				if($amount2==3){$text="Thirty";}
				if($amount2==4){$text="Fourty";}
				if($amount2==5){$text="Fifty";}
				if($amount2==6){$text="Sixty";}
				if($amount2==7){$text="Seventy";}
				if($amount2==8){$text="Eighty";}
				if($amount2==9){$text="Ninety";}
				if($amount3==1){$text1="One";}
				if($amount3==2){$text1="Two";}
				if($amount3==3){$text1="Three";}
				if($amount3==4){$text1="Four";}
				if($amount3==5){$text1="Five";}
				if($amount3==6){$text1="Six";}
				if($amount3==7){$text1="Seven";}
				if($amount3==8){$text1="Eight";}
				if($amount3==9){$text1="Nine";}
			}
	  
	  echo $text." ".$text1." "."Lac"." ";
	  }
	  function seventh1()//-------------------for thousands----------------
	  {
	  		$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,2,$length-5);//-------------------the 3rd & 4th digit-----
			$amount2=substr($rupees,3,$length-6);//-------------------the 4th digit-----
            $amount3=substr($rupees,2,$length-6);//-------------------the 3rd digit-----
			$amount4=substr($rupees,4,$length-6);//-------------------the 5th digit-----
			$amount5=substr($rupees,5,$length-6);//-------------------the 6th digit-----
			$amount6=substr($rupees,6,$length-6);//-------------------the 7th digit-----
			$amount7=substr($rupees,5,$length-5);//-------------------the last two digit-----

			if($amount1==11){$text="Eleven Thousand";}
			if($amount1==12){$text= "Twelve Thousand";}
			if($amount1==13){$text="Thirteen Thousand";}
			if($amount1==14){$text="Fourteen Thousand";}
			if($amount1==15){$text="Fifteen Thousand";}
			if($amount1==16){$text="Sixteen Thousand";}
			if($amount1==17){$text="Seventeen Thousand";}
			if($amount1==18){$text="Eighteen Thousand";}
			if($amount1==19){$text="Nineteen Thousand";}
			if($amount2==0)
					{
						if($amount3==1){$text="Ten Thousand";}
						if($amount3==2){$text="Twenty Thousand";}
						if($amount3==3){$text="Thirty Thousand";}
						if($amount3==4){$text="Fourty Thousand";}
						if($amount3==5){$text="Fifty Thousand";}
						if($amount3==6){$text="Sixty Thousand";}
						if($amount3==7){$text="Seventy Thousand";}
						if($amount3==8){$text="Eighty Thousand";}
						if($amount3==9){$text="Ninety Thousand";}
					}
			if($amount2!=0&&$amount1!=11&&$amount1!=12&&$amount1!=13&&$amount1!=14&&$amount1!=15&&$amount1!=16&&$amount1!=17&&$amount1!=18&&$amount1!=19)
					{
						if($amount3==2){$text="Twenty";}
						if($amount3==3){$text="Thirty";}
						if($amount3==4){$text="Fourty";}
						if($amount3==5){$text="Fifty";}
						if($amount3==6){$text="Sixty";}
						if($amount3==7){$text="Seventy";}
						if($amount3==8){$text="Eighty";}
						if($amount3==9){$text="Ninety";}
						if($amount2==1){$text1="One";}
						if($amount2==2){$text1="Two";}
						if($amount2==3){$text1="Three";}
						if($amount2==4){$text1="Four";}
						if($amount2==5){$text1="Five";}
						if($amount2==6){$text1="Six";}
						if($amount2==7){$text1="Seven";}
						if($amount2==8){$text1="Eight";}
						if($amount2==9){$text1="Nine";}
						$text=$text." ".$text1." "."Thousand"." ";
					}
						if($amount4==1){$text2="One Hundred";}
						if($amount4==2){$text2="Two Hundred";}
						if($amount4==3){$text2="Three Hundred";}
						if($amount4==4){$text2="Four Hundred";}
						if($amount4==5){$text2="Five Hundred";}
						if($amount4==6){$text2="Six Hundred";}
						if($amount4==7){$text2="Seven Hundred";}
						if($amount4==8){$text2="Eight Hundred";}
						if($amount4==9){$text2="Nine Hundred";}
						
						if($amount7==11){$text3="Eleven";}
						if($amount7==12){$text3= "Twelve";}
						if($amount7==13){$text3="Thirteen";}
						if($amount7==14){$text3="Fourteen";}
						if($amount7==15){$text3="Fifteen";}
						if($amount7==16){$text3="Sixteen";}
						if($amount7==17){$text3="Seventeen";}
						if($amount7==18){$text3="Eighteen";}
						if($amount7==19){$text3="Nineteen";}
						
						if($amount6==0)
						{
							if($amount5==1){$text3="Ten";}
							if($amount5==2){$text3="Twenty";}
							if($amount5==3){$text3="Thirty";}
							if($amount5==4){$text3="Fourty";}
							if($amount5==5){$text3="Fifty";}
							if($amount5==6){$text3="Sixty";}
							if($amount5==7){$text3="Seventy";}
							if($amount5==8){$text3="Eighty";}
							if($amount5==9){$text3="Ninety";}
						}
						
						if($amount6!=0&&$amount7!=11&&$amount7!=12&&$amount7!=13&&$amount7!=14&&$amount7!=15&&$amount7!=16&&$amount7!=17&&$amount7!=18&&$amount7!=19)
					{
						if($amount5==2){$text3="Twenty";}
						if($amount5==3){$text3="Thirty";}
						if($amount5==4){$text3="Fourty";}
						if($amount5==5){$text3="Fifty";}
						if($amount5==6){$text3="Sixty";}
						if($amount5==7){$text3="Seventy";}
						if($amount5==8){$text3="Eighty";}
						if($amount5==9){$text3="Ninety";}
						if($amount6==1){$text4="One";}
						if($amount6==2){$text4="Two";}
						if($amount6==3){$text4="Three";}
						if($amount6==4){$text4="Four";}
						if($amount6==5){$text4="Five";}
						if($amount6==6){$text4="Six";}
						if($amount6==7){$text4="Seven";}
						if($amount6==8){$text4="Eight";}
						if($amount6==9){$text4="Nine";}
					}		
		 echo $text." ".$text2." ".$text3." ".$text4;	
	  }
	 //-------------------------------for 7 digit(END)-------
	//-------------------------------for 8 digit(start)-------
	
	function eighth()
	{
			$rupees=$_SESSION['amt'];
			$rupees=bcdiv($rupees,1,2);
			$length1=strlen($rupees);
			$length=$length1-3;
			$amount=substr($rupees,0,$length);
			$amount1=substr($rupees,0,$length-7);//-------------the first digit----------
            if($amount1==1){$text="One Crore";}
			if($amount1==2){$text="Two Crore";}
			if($amount1==3){$text="Three Crore";}
			if($amount1==4){$text="Four Crore";}
			if($amount1==5){$text="Five Crore";}
			if($amount1==6){$text="Six Crore";}
			if($amount1==7){$text="Seven Crore";}
			if($amount1==8){$text="Eight Crore";}
			if($amount1==9){$text="Nine Crore";}
	   echo $text;
	}
	
	
	
	
	
   //-------------------------------for 8 digit(END)-------

	 
}
?>
<?php 
$tot=new sum();
if($length==1){$total=$tot->first();}
if($length==2){$total=$tot->second1();$total=$tot->second2();}
if($length==3){$total=$tot->third();$total=$tot->third1();}
if($length==4){$total=$tot->fourth();$total=$tot->fourth1();}
if($length==5){$total=$tot->fifth();$total=$tot->fifth1();}
if($length==6){$total=$tot->sixth();$total=$tot->sixth1();}
if($length==7){$total=$tot->seventh();$total=$tot->seventh1();}
if($length==8){$total=$tot->eighth();}

echo $total;
unset($_SESSION['amt']);

?>