Convert Fahrenheit to Celsius using PHP

Calculate by formula

<?php

function fahrenheitToCelsius(float $fahrenheit): float
{
    return ($fahrenheit - 32) / 1.8;
}

$fahrenheit = 77.9;
$celsius = fahrenheitToCelsius($fahrenheit);

echo $celsius;

Leave a Comment

Cancel reply

Your email address will not be published.