Speed Converter - Pixeleco.com"; echo "

Speed Converter

Convert

       Back to main page

 

"; if(!($fromvalue)) { echo "Please fill From value"; exit; } if($from==''||$to=='') { echo "Please select both From and To"; exit; } $myFile=fopen('speed.dat','r'); do { $line=fgets($myFile,30); $lineArray=explode(' ',$line); if($lineArray[0]==$from) $temp=(double)$lineArray[1]*$fromvalue; } while($lineArray[0]!=$from); fclose($myFile); $myFile=fopen('speed.dat','r'); do { $line=fgets($myFile,30); $lineArray=explode(' ',$line); if($lineArray[0]==$to) $tovalue=$temp/(double)$lineArray[1]; } while($lineArray[0]!=$to); fclose($myFile); $fromvalue=number_format($fromvalue); $tovalue=number_format($tovalue,3); echo "

Result

"; echo "

"; echo $fromvalue; echo ""." $from".$fromadd." = ".""; echo $tovalue; echo ""." $to

".$toadd; ?>