• Convert Temperature using PHP

    Kindly find the code for Convert Temperature using PHP.

    Temperature Conversion

    Degrees:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    
    <!--?php 
     if(isset($_POST['degree']))
     {
    	 $degree = $_POST['degree'];
    	 $scale = $_POST['scale'];
     
    	 if ($scale == "celcius") 
    	 {print "
    <table border--> Conversion 
     
    Results$degreecelsius"; 
    	 $c_2_f = $degree*9/5+32; 
    	 print "$c_2_ffahrenheit"; 
    	 $c_2_k = $degree+273.15; 
    	 print "$c_2_k kelvin"; 
    	 $c_2_r = $c_2_f+459.6; 
    	 print "$c_2_rrankine";} 
     
    	 if ($scale == "fahrenheit") 
    	 {print ""; 
    	 $f_2_c = ($degree -32)*5/9; 
    	 print ""; 
    	 $f_2_k = $f_2_c+273.15; 
    	 print ""; 
    	 $f_2_r = $degree+459.6; 
    	 print "
    ConversionResults
    $degree farhenheit
    $f_2_c celsius
    $f_2_k kelvin
    $f_2_r rankine
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    ";} 
     
    	 if ($scale == "kelvin") 
    	 {print ""; 
    	 $k_2_f = ($degree - 273.15) * 9 / 5 + 32; 
    	 print ""; 
    	 $k_2_c = $degree-273.15; 
    	 print ""; 
    	 $k_2_r = $k_2_f+459.6; 
    	 print "
    ConversionResults
    $degree kelvin
    $k_2_f fahrenheit
    $k_2_c celsius
    $k_2_r rankine
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    ";} 
     
    	 if ($scale == "rankine") 
    	 {print ""; 
    	 $r_2_f = $degree-459.6; 
    	 print ""; 
    	 $r_2_c = ($r_2_f - 32)*5/9; 
    	 print ""; 
    	 $r_2_k = $r_2_c + 273.15; 
    	 print "
    ConversionResults
    $degree rankine
    $r_2_f fahrenheit
    $r_2_c celsius
    $r_2_k kelvin
    1
    2
    3
    
    ";} 
     }
     ?&gt;

    Hope you enjoyed!

Comments on this post

Leave a Reply

  • Security Code :


    eight × = 32