get system cpu temperature in fahrenheit in php

You can use the sys_get_temp() function to get the CPU temperature in Celsius and then convert it to Fahrenheit using the formula (Celsius * 1.8) + 32. Here's a code snippet that shows how to do this:

main.php
$celsius = sys_get_temp();
$fahrenheit = ($celsius * 1.8) + 32;
echo "CPU temperature is: " . $fahrenheit . " °F";
115 chars
4 lines

Note that this function only works on Linux-based systems with support for the lm-sensors package installed. If you're running PHP on Windows or another non-Linux system, you'll need to use a different method to get the CPU temperature.

gistlibby LogSnag