Server-Side Scripting/Strings and Files/PHP

index.php
";   return $result; }

function process_line($line) { $index = strpos($line, "° F"); if ($index < 0) { return "Invalid file format"; }

$fahrenheit = floatval(substr($line, 0, $index)); $celsius = ($fahrenheit - 32) * 5 / 9; $result = " ". $fahrenheit. " ";   $result = $result. " " . number_format($celsius, 1). " ";

return $result; }

?>

Try It
Copy and paste the code above into the following free online development environment or use your own compiler / interpreter / IDE.
 * PHPFiddle
 * Repl.it