3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo whole_fraction(23.54); function whole_fraction($decimal){ $big_fraction = float2rat($decimal); ($numerator, $denomenator) = explode('/', $big_fraction); $whole_number = floor($numerator/$decimal_number); $numerator = $numerator % $denomenator; $fraction = $whole_number . ' ' . $numerator . '/' . $denomenator; } function float2rat($n, $tolerance = 1.e-6) { $h1=1; $h2=0; $k1=0; $k2=1; $b = 1/$n; do { $b = 1/$b; $a = floor($b); $aux = $h1; $h1 = $a*$h1+$h2; $h2 = $aux; $aux = $k1; $k1 = $a*$k1+$k2; $k2 = $aux; $b = $b-$a; } while (abs($n-$h1/$k1) > $n*$tolerance); return "$h1/$k1"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.340.0230.04319.16
5.4.320.0200.04018.99
5.4.310.0230.04718.97
5.4.300.0270.03018.84
5.4.290.0170.04319.11
5.4.280.0170.05019.18
5.4.270.0170.03719.10
5.4.260.0200.03718.84
5.4.250.0530.03719.22
5.4.240.0230.03319.06
5.4.230.0300.04319.20
5.4.220.0200.04018.84
5.4.210.0300.04319.21
5.4.200.0230.03719.20
5.4.190.0230.03719.18
5.4.180.0200.04019.07
5.4.170.0270.03319.14
5.4.160.0230.04318.96
5.4.150.0200.07319.04
5.4.140.0130.04016.32
5.4.130.0170.03716.32
5.4.120.0130.04016.43
5.4.110.0130.04016.19
5.4.100.0170.04316.36
5.4.90.0230.04016.56
5.4.80.0300.05016.34
5.4.70.0200.04016.56
5.4.60.0670.05716.17
5.4.50.0200.03716.23
5.4.40.0500.07016.25
5.4.30.0200.04316.21
5.4.20.0470.03316.50
5.4.10.0200.04016.39
5.4.00.0130.03715.77
5.3.290.0230.07014.65
5.3.280.0200.07314.60
5.3.270.0200.05714.55
5.3.260.0170.04714.66
5.3.250.0170.04014.83
5.3.240.0200.04314.83
5.3.230.0070.04314.68
5.3.220.0100.04714.62
5.3.210.0230.07314.50
5.3.200.0200.07014.49
5.3.190.0200.06314.79
5.3.180.0270.06714.64
5.3.170.0170.04314.66
5.3.160.0230.06714.58
5.3.150.0300.06314.47
5.3.140.0170.05314.64
5.3.130.0200.06714.60
5.3.120.0170.05714.63
5.3.110.0230.06014.55
5.3.100.0170.06014.06
5.3.90.0200.07314.07
5.3.80.0170.07314.13
5.3.70.0130.04713.95
5.3.60.0230.06714.09
5.3.50.0230.07313.85
5.3.40.0170.07313.92
5.3.30.0230.06713.96
5.3.20.0270.06313.74
5.3.10.0130.04313.80
5.3.00.0270.06013.86
5.2.170.0200.05311.10
5.2.160.0130.05711.05
5.2.150.0130.05711.15
5.2.140.0230.04011.04
5.2.130.0130.03311.01
5.2.120.0170.02711.03
5.2.110.0130.06011.12
5.2.100.0130.04311.21
5.2.90.0270.03011.11
5.2.80.0170.03711.24
5.2.70.0130.05011.07
5.2.60.0170.05011.05
5.2.50.0170.03710.92
5.2.40.0600.04710.90
5.2.30.0570.05010.89
5.2.20.0170.06010.96
5.2.10.0530.05311.01
5.2.00.0130.06310.71
5.1.60.0130.04010.22
5.1.50.0200.03710.07
5.1.40.0100.0379.87
5.1.30.0200.02310.32
5.1.20.0070.04010.43
5.1.10.0230.0239.97
5.1.00.0100.03310.12
5.0.50.0400.0308.63
5.0.40.0100.0178.38
5.0.30.0030.0378.13
5.0.20.0000.0238.14
5.0.10.0070.0178.29
5.0.00.0070.0378.24
4.4.90.0030.0177.02
4.4.80.0030.0177.02
4.4.70.0030.0207.02
4.4.60.0030.0177.02
4.4.50.0100.0207.02
4.4.40.0100.0277.02
4.4.30.0030.0177.02
4.4.20.0070.0177.02
4.4.10.0000.0207.02
4.4.00.0070.0277.02
4.3.110.0100.0107.02
4.3.100.0100.0107.02
4.3.90.0030.0207.02
4.3.80.0100.0207.02
4.3.70.0200.0207.02
4.3.60.0100.0137.02
4.3.50.0130.0137.02
4.3.40.0030.0307.02
4.3.30.0100.0177.02
4.3.20.0070.0177.02
4.3.10.0070.0137.02
4.3.00.0030.0207.02

preferences:
142.54 ms | 1394 KiB | 7 Q