Temperature Calculator
Convert temperatures between Celsius, Fahrenheit and Kelvin.
Gratis ate 10 MB por arquivo100 MB por enviosem anuncio antes do limite
$titulo = 'Calculadora de Temperatura';
$descricao = 'Converta temperaturas entre Celsius, Fahrenheit e Kelvin de forma rápida e fácil';
$palavrasChave = 'temperatura, conversor, celsius, fahrenheit, kelvin';
$valor = '';
$de = 'celsius';
$para = 'fahrenheit';
$resultado = null;
$explicacao = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$valor = str_replace(',', '.', $_POST['valor'] ?? '');
$de = $_POST['de'] ?? 'celsius';
$para = $_POST['para'] ?? 'fahrenheit';
if (is_numeric($valor)) {
$valorNum = floatval($valor);
$resultado = converterTemperatura($valorNum, $de, $para);
$explicacao = gerarExplicacao($valorNum, $de, $para, $resultado);
}
}
function converterTemperatura($valor, $de, $para) {
// Converte tudo para Celsius primeiro
$celsius = 0;
switch ($de) {
case 'celsius':
$celsius = $valor;
break;
case 'fahrenheit':
$celsius = ($valor - 32) * 5/9;
break;
case 'kelvin':
$celsius = $valor - 273.15;
break;
}
// Converte de Celsius para a unidade desejada
switch ($para) {
case 'celsius':
return $celsius;
case 'fahrenheit':
return $celsius * 9/5 + 32;
case 'kelvin':
return $celsius + 273.15;
}
return null;
}
function gerarExplicacao($valor, $de, $para, $resultado) {
$unidades = [
'celsius' => '°C',
'fahrenheit' => '°F',
'kelvin' => 'K'
];
$deNome = $unidades[$de];
$paraNome = $unidades[$para];
return "Conversão: {$valor} {$deNome} = " . number_format($resultado, 2) . " {$paraNome}";
}
?>
Recommended next step
Keep this result working for you
Minike connects the tool you are using with the product most likely to generate recurring value.
$9.90/mo
Minike Tools Pro
Bigger conversions, no main ads and priority processing.
Free: 10 MB per file and 100 MB per batch.
$5.90/mo
Minike Sites
Turn converted assets into pages, landing pages and stores.
Free preview before publishing.
Prices shown for Brazil and US positioning. Current local checkout charges BRL until the international gateway is enabled.