3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ "5'", "5' 0", "5' 0 1/2", "5' 1", "5' 1 1/2", "5' 2", "5' 2 1/2", "7' 4", ]; foreach ($tests as $test) { sscanf($test, '%d\' %d %d/%d"', $feet, $inches, $numerator, $denominator); printf("%.1f\n", ($feet * 12) + $inches + ($denominator ? $numerator / $denominator : 0)); }
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
60.0 60.0 60.5 61.5 61.5 62.5 62.5 88.5

preferences:
71.45 ms | 406 KiB | 5 Q