What is the best practice for converting Fahrenheit to Celsius in PHP when retrieving data from a database?

When retrieving temperature data from a database in Fahrenheit and needing to display it in Celsius, the best practice is to convert the temperature using a simple formula. The formula for converting Fahrenheit to Celsius is: (Fahrenheit - 32) * 5/9. This formula can be implemented in PHP code to convert the temperature values before displaying them to the user.

// Retrieve temperature data from the database in Fahrenheit
$fahrenheit = $row['temperature'];

// Convert Fahrenheit to Celsius
$celsius = ($fahrenheit - 32) * 5/9;

// Display the temperature in Celsius
echo "Temperature in Celsius: " . $celsius . "°C";