3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo whole_fraction(23.54); function whole_fraction($decimal){ $big_fraction = float2rat($decimal); $num_array = explode('/', $big_fraction); $numerator = $num_array[0]; $denomenator = $num_array[1]; $whole_number = floor($numerator/$denominator); $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)
8.3.60.0040.01118.43
8.3.50.0160.00422.12
8.3.40.0040.01118.88
8.3.30.0110.00419.23
8.3.20.0000.00820.32
8.3.10.0040.00423.65
8.3.00.0050.00319.26
8.2.180.0060.00918.29
8.2.170.0120.00319.09
8.2.160.0120.00322.96
8.2.150.0000.00924.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00421.02
8.2.110.0150.00420.99
8.2.100.0090.00317.88
8.2.90.0030.00519.25
8.2.80.0050.00317.97
8.2.70.0060.00317.75
8.2.60.0080.00018.16
8.2.50.0060.00318.07
8.2.40.0050.00318.37
8.2.30.0000.00718.27
8.2.20.0000.00817.90
8.2.10.0040.00418.20
8.2.00.0060.00317.87
8.1.280.0060.00925.92
8.1.270.0000.00822.06
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0140.00722.13
8.1.230.0080.00418.99
8.1.220.0080.00017.91
8.1.210.0040.00418.77
8.1.200.0030.01017.48
8.1.190.0030.00517.38
8.1.180.0000.00718.10
8.1.170.0040.00418.62
8.1.160.0070.00022.04
8.1.150.0050.00218.98
8.1.140.0000.00817.36
8.1.130.0000.00717.44
8.1.120.0040.00417.39
8.1.110.0040.00417.47
8.1.100.0050.00217.39
8.1.90.0040.00417.39
8.1.80.0000.00717.47
8.1.70.0030.00317.47
8.1.60.0060.00617.65
8.1.50.0080.00017.50
8.1.40.0050.00317.59
8.1.30.0080.00017.59
8.1.20.0080.00017.72
8.1.10.0040.00417.63
8.1.00.0000.00717.63
8.0.300.0000.00818.77
8.0.290.0040.00416.88
8.0.280.0070.00018.54
8.0.270.0030.00317.30
8.0.260.0060.00016.88
8.0.250.0000.00717.10
8.0.240.0040.00417.08
8.0.230.0030.00517.00
8.0.220.0050.00317.01
8.0.210.0000.00717.11
8.0.200.0030.00317.01
8.0.190.0050.00317.07
8.0.180.0000.00716.96
8.0.170.0000.00817.05
8.0.160.0040.00417.03
8.0.150.0000.00816.93
8.0.140.0040.00416.98
8.0.130.0000.00613.48
8.0.120.0000.00816.96
8.0.110.0050.00317.02
8.0.100.0000.00716.91
8.0.90.0040.00416.97
8.0.80.0080.00817.00
8.0.70.0050.00316.99
8.0.60.0030.00517.09
8.0.50.0000.00717.06
8.0.30.0090.01017.16
8.0.20.0130.00717.40
8.0.10.0030.00516.99
8.0.00.0090.00916.83
7.4.330.0000.00515.13
7.4.320.0060.00016.55
7.4.300.0030.00316.60
7.4.290.0000.00916.71
7.4.280.0070.00016.63
7.4.270.0000.00716.61
7.4.260.0040.00416.57
7.4.250.0070.00016.66
7.4.240.0020.00516.59
7.4.230.0000.00816.39
7.4.220.0110.01116.65
7.4.210.0060.00916.63
7.4.200.0030.00316.39
7.4.160.0050.01116.68
7.4.150.0070.01117.40
7.4.140.0130.00917.86
7.4.130.0090.01416.62
7.4.120.0120.00816.65
7.4.110.0070.01016.69
7.4.100.0070.01016.65
7.4.90.0070.01016.59
7.4.80.0160.02519.39
7.4.70.0060.01116.61
7.4.60.0100.00616.55
7.4.50.0040.00416.45
7.4.40.0070.01016.66
7.4.30.0100.00616.73
7.4.00.0090.00615.03
7.3.330.0030.00313.38
7.3.320.0020.00213.48
7.3.310.0030.00316.55
7.3.300.0040.00416.43
7.3.290.0080.00716.52
7.3.280.0080.00716.47
7.3.270.0130.00717.40
7.3.260.0070.01016.71
7.3.250.0060.01216.57
7.3.240.0060.01516.50
7.3.230.0080.00816.61
7.3.210.0080.00816.69
7.3.200.0100.00719.39
7.3.190.0130.00316.65
7.3.180.0000.01616.69
7.3.170.0080.00816.54
7.3.160.0070.01016.52
7.3.10.0130.00316.80
7.3.00.0100.00316.74
7.2.330.0150.00316.83
7.2.320.0080.00916.74
7.2.310.0000.02116.67
7.2.300.0030.01316.70
7.2.290.0150.00916.82
7.2.130.0100.00617.01
7.2.120.0030.01016.95
7.2.110.0070.01017.11
7.2.100.0030.00617.07
7.2.90.0000.01417.08
7.2.80.0030.01017.07
7.2.70.0060.00316.98
7.2.60.0060.00916.91
7.2.50.0070.01016.92
7.2.40.0000.01017.01
7.2.30.0070.00716.61
7.2.20.0120.00317.03
7.2.10.0120.00316.79
7.2.00.0040.01118.14
7.1.250.0090.00615.88
7.1.100.0030.01318.15
7.1.70.0040.00717.02
7.1.60.0070.01719.32
7.1.50.0090.01617.01
7.1.00.0070.07322.24
7.0.200.0000.00716.77
7.0.140.0030.07322.15
7.0.60.0130.07320.04
7.0.50.0070.05017.89
7.0.40.0030.07320.24
7.0.30.0230.04320.33
7.0.20.0300.07720.01
7.0.10.0030.09020.20
7.0.00.0070.06320.23
5.6.280.0030.07321.07
5.6.210.0030.08720.73
5.6.200.0070.08718.16
5.6.190.0130.03720.52
5.6.180.0230.03320.34
5.6.170.0230.05320.44
5.6.160.0030.05720.54
5.6.150.0070.04318.16
5.6.140.0070.04718.14
5.6.130.0000.04318.21
5.6.120.0100.05321.11
5.6.110.0000.08020.99
5.6.100.0000.07021.00
5.6.90.0100.08020.98
5.6.80.0100.06720.41
5.6.70.4270.03720.36
5.5.350.0270.02720.31
5.5.340.0100.07318.02
5.5.330.0030.05720.47
5.5.320.0170.04320.27
5.5.310.0300.07320.41
5.5.300.0130.04017.93
5.5.290.0030.08318.08
5.5.280.0030.06020.63
5.5.270.0130.05720.76
5.5.260.0030.04320.73
5.5.250.0000.06720.80
5.5.240.4070.04020.27
5.4.450.0370.06019.48
5.4.440.0670.07019.61
5.4.430.0570.06719.46
5.4.420.0800.05719.61
5.4.410.0900.07319.30
5.4.400.0870.07719.14
5.4.390.0830.04319.25
5.4.380.0670.06018.87
5.4.370.0430.05019.16
5.4.360.0770.05719.25
5.4.350.1000.04319.30
5.4.340.0080.03612.02
5.4.320.0050.03912.51
5.4.310.0050.04212.51
5.4.300.0090.03312.51
5.4.290.0050.03912.51
5.4.280.0040.03612.40
5.4.270.0050.03612.40
5.4.260.0050.03812.40
5.4.250.0040.03812.40
5.4.240.0030.03812.40
5.4.230.0060.03612.40
5.4.220.0020.04412.39
5.4.210.0050.03512.39
5.4.200.0080.03412.40
5.4.190.0120.02912.39
5.4.180.0050.03512.39
5.4.170.0110.03712.39
5.4.160.0050.03512.39
5.4.150.0060.03412.39
5.4.140.0040.04012.08
5.4.130.0050.04712.06
5.4.120.0050.04212.02
5.4.110.0050.03412.01
5.4.100.0090.03212.02
5.4.90.0090.04612.02
5.4.80.0050.03812.02
5.4.70.0040.03412.01
5.4.60.0050.03312.01
5.4.50.0050.03512.01
5.4.40.0050.03812.00
5.4.30.0080.03612.00
5.4.20.0060.03912.00
5.4.10.0070.04312.00
5.4.00.0040.03711.49
5.3.290.0050.03912.80
5.3.280.0080.04612.71
5.3.270.0040.03912.72
5.3.260.0080.03512.72
5.3.250.0080.03412.72
5.3.240.0060.03612.72
5.3.230.0040.03812.71
5.3.220.0060.04212.68
5.3.210.0050.03812.68
5.3.200.0060.03512.68
5.3.190.0030.03812.68
5.3.180.0080.03312.67
5.3.170.0030.04512.67
5.3.160.0060.04012.68
5.3.150.0060.03912.67
5.3.140.0070.03812.66
5.3.130.0060.04112.66
5.3.120.0070.03912.66
5.3.110.0030.04012.66
5.3.100.0080.03812.13
5.3.90.0040.03612.11
5.3.80.0050.03512.10
5.3.70.0020.03812.10
5.3.60.0060.03712.09
5.3.50.0070.03612.03
5.3.40.0090.03212.03
5.3.30.0120.02811.99
5.3.20.0030.03811.77
5.3.10.0040.03511.75
5.3.00.0060.04011.72
5.2.170.0060.0319.23
5.2.160.0080.0269.22
5.2.150.0010.0349.23
5.2.140.0080.0319.22
5.2.130.0080.0269.18
5.2.120.0020.0309.18
5.2.110.0040.0289.19
5.2.100.0060.0349.19
5.2.90.0040.0319.18
5.2.80.0050.0289.18
5.2.70.0030.0309.18
5.2.60.0060.0319.14
5.2.50.0090.0389.11
5.2.40.0070.0319.08
5.2.30.0020.0319.06
5.2.20.0070.0269.04
5.2.10.0020.0328.97
5.2.00.0070.0348.84
5.1.60.0060.0288.11
5.1.50.0050.0238.11
5.1.40.0040.0238.09
5.1.30.0050.0248.44
5.1.20.0050.0288.46
5.1.10.0060.0278.19
5.1.00.0040.0298.19
5.0.50.0040.0206.68
5.0.40.0040.0196.54
5.0.30.0050.0306.36
5.0.20.0020.0206.33
5.0.10.0050.0196.31
5.0.00.0070.0276.30
4.4.90.0050.0154.78
4.4.80.0050.0174.75
4.4.70.0010.0174.75
4.4.60.0020.0164.75
4.4.50.0030.0204.77
4.4.40.0050.0294.71
4.4.30.0030.0184.76
4.4.20.0040.0144.84
4.4.10.0040.0144.85
4.4.00.0060.0224.76
4.3.110.0020.0164.67
4.3.100.0000.0204.66
4.3.90.0010.0234.63
4.3.80.0020.0274.60
4.3.70.0050.0124.63
4.3.60.0020.0154.63
4.3.50.0030.0154.63
4.3.40.0010.0254.55
4.3.30.0030.0153.36
4.3.20.0020.0163.35
4.3.10.0010.0163.30
4.3.00.0070.0236.80

preferences:
47.38 ms | 401 KiB | 5 Q