@ 2015-05-27T14:42:33Z <?php
function work($i){
list($v, $u) = split(" ", $i);
$u == 'C' || print( $v = $u == 'K' ? $v - 273.15 : ($v - 32)*5/9 ) . " C\n";
$u != "K" && print $v + 273.15 . " K\n";
$u != "F" && print $v * 9/5 + 32 . " F\n";
}
function f($i){list($v,$u)=split(" ",$i);$u==C||print($v=$u==K?$v-273.15:($v-32)*5/9)."C\n";$u!=K&&print $v+273.15 ."K\n";$u!=F&&print $v*9/5+32 ."F\n";}
@f("23 C"); echo "\n\n"; // Expect 73.4 F 296.15 K
@f("86.987 F"); echo "\n\n"; // Expect 303.6983 K 30.5483 C
@f("56.99999999 K"); echo "\n\n"; // Expect -216.1500 C -357.0700 F
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 Fatal error: Uncaught Error: Call to undefined function split() in /in/CpvG7:10
Stack trace:
#0 /in/CpvG7(12): f('23 C')
#1 {main}
thrown in /in/CpvG7 on line 10
Process exited with code 255 . Output for 4.3.0 - 4.3.11 , 4.4.0 - 4.4.9 , 5.0.0 - 5.0.5 , 5.1.1 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.28 296.15K
73.4F
30.548333333333C
303.69833333333K
-216.15000001C
-357.070000018F
Output for 5.1.0 Fatal error: fatal flex scanner internal error--end of buffer missed in /in/CpvG7 on line 14
Process exited with code 255 . preferences:dark mode live preview
227.67 ms | 401 KiB | 313 Q