3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo get_fraction(3.4); function get_fraction($decimal){ $decimal_array = explode( $decimal, '.'); $whole_number = $decimal_array[0]; $decimal_number = $decimal_array[1]; $multiplier = "1"; for ($i = 0; $i < strlen($decimal_number); $i++) { $multiplier .= '0'; } $multiplier = int($multiplier); $decimal_int = $multiplier * $decimal_number; for ($i = 2; $i < $decimal_int; $i++) { if( $decimal_int % $i == 0 && $multiplier % i == 0){ $decimal_int = $decimal_int / $i; $multiplier = $multiplier / $i; } // code... } if( $decimal_int){ if( $whole_number){ return $whole_number . ' ' . $decimal_int . '/' . $multiplier; }else{ return $decimal_int . '/' . $multiplier; } }else{ return $whole_number; } }

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.0080.00618.20
8.3.50.0170.00321.17
8.3.40.0090.00618.79
8.3.30.0070.01019.21
8.3.20.0000.00920.30
8.3.10.0080.00823.72
8.3.00.0040.00419.25
8.2.180.0030.01516.75
8.2.170.0140.00722.96
8.2.160.0070.00720.32
8.2.150.0000.00724.18
8.2.140.0000.00824.66
8.2.130.0110.00426.16
8.2.120.0110.00320.92
8.2.110.0090.00020.53
8.2.100.0100.00618.03
8.2.90.0000.00819.05
8.2.80.0040.00417.97
8.2.70.0060.00317.71
8.2.60.0040.00417.93
8.2.50.0060.00318.07
8.2.40.0050.00318.22
8.2.30.0030.00518.10
8.2.20.0040.00417.77
8.2.10.0000.00718.06
8.2.00.0040.00417.80
8.1.280.0140.00025.92
8.1.270.0080.00023.91
8.1.260.0050.00326.35
8.1.250.0070.00728.09
8.1.240.0060.00323.82
8.1.230.0120.00019.04
8.1.220.0080.00017.79
8.1.210.0050.00318.77
8.1.200.0060.00617.35
8.1.190.0000.00817.23
8.1.180.0000.00818.10
8.1.170.0080.00018.46
8.1.160.0000.00722.02
8.1.150.0080.00018.86
8.1.140.0080.00017.40
8.1.130.0030.00317.84
8.1.120.0040.00417.42
8.1.110.0040.00417.29
8.1.100.0000.00717.43
8.1.90.0040.00417.41
8.1.80.0000.00717.41
8.1.70.0070.00017.28
8.1.60.0060.00317.56
8.1.50.0040.00417.56
8.1.40.0000.00717.50
8.1.30.0040.00417.50
8.1.20.0080.00017.70
8.1.10.0000.00817.48
8.1.00.0060.00317.48
8.0.300.0030.00618.77
8.0.290.0000.00716.75
8.0.280.0030.00318.39
8.0.270.0030.00317.16
8.0.260.0000.00817.21
8.0.250.0030.00316.93
8.0.240.0000.00716.92
8.0.230.0070.00016.94
8.0.220.0030.00316.86
8.0.210.0040.00416.89
8.0.200.0030.00317.00
8.0.190.0030.00516.96
8.0.180.0050.00216.90
8.0.170.0000.00816.94
8.0.160.0030.00316.79
8.0.150.0040.00416.84
8.0.140.0000.00716.90
8.0.130.0070.00013.36
8.0.120.0050.00316.77
8.0.110.0040.00416.84
8.0.100.0040.00416.89
8.0.90.0030.00616.93
8.0.80.0090.01216.93
8.0.70.0000.00816.84
8.0.60.0000.00716.84
8.0.50.0000.00716.68
8.0.30.0110.00816.95
8.0.20.0100.00917.40
8.0.10.0000.00817.08
8.0.00.0070.01216.80
7.4.330.0000.00515.07
7.4.320.0000.00616.46
7.4.300.0050.00216.55
7.4.290.0100.00016.59
7.4.280.0080.00016.62
7.4.270.0080.00016.41
7.4.260.0040.00416.43
7.4.250.0040.00416.45
7.4.240.0020.00516.62
7.4.230.0030.00316.63
7.4.220.0170.00316.55
7.4.210.0090.00616.54
7.4.200.0000.00716.61
7.4.160.0060.01016.52
7.4.150.0070.01017.40
7.4.140.0110.01117.86
7.4.130.0080.01016.53
7.4.120.0080.00916.54
7.4.110.0070.01116.71
7.4.100.0100.00716.73
7.4.90.0100.00716.45
7.4.80.0140.00319.39
7.4.70.0040.01316.52
7.4.60.0090.01216.49
7.4.50.0080.00016.73
7.4.40.0090.00916.65
7.4.30.0100.00716.57
7.4.10.0040.01415.23
7.4.00.0070.00915.01
7.3.330.0070.00013.25
7.3.320.0020.00213.39
7.3.310.0030.00316.36
7.3.300.0050.00216.42
7.3.290.0100.00416.42
7.3.280.0090.00916.43
7.3.270.0080.00817.40
7.3.260.0090.00916.54
7.3.250.0120.00516.35
7.3.240.0110.00916.38
7.3.230.0130.00316.53
7.3.210.0060.01016.41
7.3.200.0110.01119.39
7.3.190.0190.00316.54
7.3.180.0060.01216.56
7.3.170.0060.01516.41
7.3.160.0080.00816.43
7.3.130.0070.01014.93
7.3.120.0060.01215.14
7.3.110.0140.00314.83
7.3.100.0100.00315.10
7.3.90.0100.01014.95
7.3.80.0110.00414.80
7.3.70.0040.00514.81
7.3.60.0070.01014.74
7.3.50.0030.01214.79
7.3.40.0040.00814.58
7.3.30.0030.00714.88
7.3.20.0070.00716.38
7.3.10.0070.00316.68
7.3.00.0120.00316.65
7.2.330.0060.01516.53
7.2.320.0030.01316.53
7.2.310.0180.00316.40
7.2.300.0130.00316.58
7.2.290.0140.00716.33
7.2.260.0100.00714.99
7.2.250.0060.01014.62
7.2.240.0030.01014.62
7.2.230.0070.00315.01
7.2.220.0160.00314.76
7.2.210.0030.01215.17
7.2.200.0070.00715.11
7.2.190.0060.00914.86
7.2.180.0070.01115.24
7.2.170.0000.01114.88
7.2.160.0080.00614.85
7.2.150.0040.01116.71
7.2.140.0000.01116.63
7.2.130.0100.00316.84
7.2.120.0000.01516.77
7.2.110.0070.00616.50
7.2.100.0050.00916.60
7.2.90.0080.00716.86
7.2.80.0120.00516.84
7.2.70.0080.00917.02
7.2.60.0120.00516.79
7.2.50.0070.00716.77
7.2.40.0070.00916.81
7.2.30.0120.00516.66
7.2.20.0100.00516.93
7.2.10.0080.00816.79
7.2.00.0020.01017.70
7.1.330.0040.00815.97
7.1.320.0090.00615.98
7.1.310.0080.00315.89
7.1.300.0120.00615.92
7.1.290.0030.00915.88
7.1.280.0130.00015.77
7.1.270.0000.01115.51
7.1.260.0080.00515.79
7.1.250.0090.00016.02
7.1.240.0050.00915.63
7.1.230.0090.00415.79
7.1.220.0080.00515.89
7.1.210.0070.00915.71
7.1.200.0050.00815.68
7.1.190.0050.00915.73
7.1.180.0080.00715.68
7.1.170.0050.00715.74
7.1.160.0090.00315.67
7.1.150.0150.00315.82
7.1.140.0050.00615.77
7.1.130.0060.00815.66
7.1.120.0070.00715.88
7.1.110.0070.00615.85
7.1.100.0080.00616.74
7.1.90.0050.00815.83
7.1.80.0060.00615.86
7.1.70.0060.00616.23
7.1.60.0050.01316.97
7.1.50.0070.00816.31
7.1.40.0050.00615.92
7.1.30.0070.00915.90
7.1.20.0070.00715.75
7.1.10.0080.00315.57
7.1.00.0090.02918.15
7.0.330.0060.00615.49
7.0.320.0050.00715.43
7.0.310.0060.00715.50
7.0.300.0080.00515.37
7.0.290.0020.01115.29
7.0.280.0090.00515.34
7.0.270.0050.00915.38
7.0.260.0060.00915.26
7.0.250.0070.01015.58
7.0.240.0050.00515.51
7.0.230.0040.00815.31
7.0.220.0060.00815.38
7.0.210.0060.01015.40
7.0.200.0060.00815.78
7.0.190.0090.00415.39
7.0.180.0050.01015.49
7.0.170.0050.00815.37
7.0.160.0070.00715.51
7.0.150.0060.00915.40
7.0.140.0090.02617.61
7.0.130.0090.00715.52
7.0.120.0060.00515.36
7.0.110.0040.00915.47
7.0.100.0100.00515.50
7.0.90.0060.00515.48
7.0.80.0110.00415.47
7.0.70.0020.01015.47
7.0.60.0060.02616.87
7.0.50.0070.01616.28
7.0.40.0060.03415.58
7.0.30.0220.02815.66
7.0.20.0080.02215.85
7.0.10.0040.03515.62
7.0.00.0040.03115.66
5.6.400.0050.00514.29
5.6.390.0100.00014.45
5.6.380.0070.00914.24
5.6.370.0020.01014.55
5.6.360.0090.00314.53
5.6.350.0070.00914.31
5.6.340.0080.01014.61
5.6.330.0050.00914.59
5.6.320.0060.00914.45
5.6.310.0100.00714.32
5.6.300.0050.01014.22
5.6.290.0110.00514.26
5.6.280.0090.02316.69
5.6.270.0090.00314.67
5.6.260.0090.00314.44
5.6.250.0100.00314.36
5.6.240.0100.00414.30
5.6.230.0130.00014.40
5.6.220.0100.00314.38
5.6.210.0050.02716.58
5.6.200.0080.02815.64
5.6.190.0070.02216.45
5.6.180.0050.02816.51
5.6.170.0170.01816.52
5.6.160.0060.02916.50
5.6.150.0050.03115.66
5.6.140.0090.03015.63
5.6.130.0100.01615.64
5.6.120.0040.01916.62
5.6.110.0060.03516.53
5.6.100.0040.01916.47
5.6.90.0080.01716.64
5.6.80.0070.03116.29
5.6.70.1570.01816.38
5.6.60.0070.00714.27
5.6.50.0070.00514.14
5.6.40.0100.00414.11
5.6.30.0080.00614.16
5.6.20.0040.00714.23
5.6.10.0080.00614.24
5.6.00.0070.00614.16
5.5.380.0080.00812.80
5.5.370.0060.00612.73
5.5.360.0070.00412.69
5.5.350.0150.03015.31
5.5.340.0050.01714.59
5.5.330.0070.01615.32
5.5.320.0150.02815.34
5.5.310.0180.02415.29
5.5.300.0080.02214.47
5.5.290.0050.02914.57
5.5.280.0090.01515.44
5.5.270.0040.02515.44
5.5.260.0070.03115.31
5.5.250.0070.03115.37
5.5.240.1490.01915.19
5.5.230.0110.00312.79
5.5.220.0080.00412.72
5.5.210.0060.01012.73
5.5.200.0130.00012.79
5.5.190.0050.00812.65
5.5.180.0050.00812.84
5.5.170.0090.00714.29
5.5.160.0060.00812.74
5.5.150.0100.00412.87
5.5.140.0120.00312.69
5.5.130.0050.00712.56
5.5.120.0040.00812.71
5.5.110.0050.00912.76
5.5.100.0050.01012.78
5.5.90.0040.01012.79
5.5.80.0060.00712.62
5.5.70.0080.00412.81
5.5.60.0040.00912.72
5.5.50.0080.00512.72
5.5.40.0070.00512.65
5.5.30.0080.00612.76
5.5.20.0100.00112.60
5.5.10.0070.00612.61
5.5.00.0080.00312.62
5.4.450.1210.01514.04
5.4.440.1220.01514.03
5.4.430.1150.01814.04
5.4.420.1220.01414.06
5.4.410.1170.01514.07
5.4.400.1130.01213.97
5.4.390.1110.01713.94
5.4.380.1220.01513.95
5.4.370.1150.01513.94
5.4.360.0990.01313.93
5.4.350.1240.01413.93
5.4.340.1530.01813.95
5.4.330.0080.00411.35
5.4.320.1320.01013.92
5.4.310.1410.01513.97
5.4.300.1130.01513.93
5.4.290.1300.01713.95
5.4.280.1380.01513.93
5.4.270.1190.01614.00
5.4.260.1110.01613.85
5.4.250.1260.01513.89
5.4.240.1030.01613.85
5.4.230.1200.01413.89
5.4.220.1000.01613.95
5.4.210.1480.01613.90
5.4.200.1400.01914.00
5.4.190.1430.01613.97
5.4.180.1450.01613.89
5.4.170.0940.01913.85
5.4.160.1030.02013.97
5.4.150.1060.01613.89
5.4.140.0970.01713.03
5.4.130.0930.01513.03
5.4.120.1110.01513.08
5.4.110.0960.01513.07
5.4.100.1050.01413.04
5.4.90.1080.01413.01
5.4.80.1260.01713.07
5.4.70.1260.01613.10
5.4.60.1170.01913.09
5.4.50.0980.01913.08
5.4.40.1350.01913.07
5.4.30.1000.01713.06
5.4.20.1010.01513.04
5.4.10.1260.01513.03
5.4.00.1300.01612.94
5.3.290.1480.02113.00
5.3.280.1790.02012.99
5.3.270.1510.02212.99
5.3.260.1180.02112.93
5.3.250.1610.02012.94
5.3.240.1260.02113.05
5.3.230.1530.02012.96
5.3.220.1440.01912.88
5.3.210.1660.01912.95
5.3.200.1740.01512.92
5.3.190.1570.02412.87
5.3.180.1540.02012.87
5.3.170.1510.02112.88
5.3.160.1790.01913.03
5.3.150.1640.01912.87
5.3.140.1860.01812.87
5.3.130.1790.01813.02
5.3.120.1680.02312.96
5.3.110.1450.01712.86
5.3.100.1770.02012.66
5.3.90.1780.02012.64
5.3.80.2050.01812.60
5.3.70.2060.01812.62
5.3.60.2120.01612.60
5.3.50.2090.02212.60
5.3.40.1870.01812.59
5.3.30.1550.02512.70
5.3.20.2120.01812.49
5.3.10.1710.01812.50
5.3.00.1720.02012.45
5.2.170.1720.02211.24
5.2.160.1630.01611.25
5.2.150.1470.02011.19
5.2.140.1680.01611.26
5.2.130.1900.01011.23
5.2.120.1580.01711.15
5.2.110.1650.01611.22
5.2.100.1190.01811.22
5.2.90.1520.01511.14
5.2.80.1230.02011.22
5.2.70.1770.01511.14
5.2.60.1320.02011.20
5.2.50.1520.01311.15
5.2.40.1200.01911.19
5.2.30.0960.02011.16
5.2.20.1200.01911.07
5.2.10.0980.02211.05
5.2.00.1060.01810.95
5.1.60.1340.01610.66
5.1.50.1110.01310.66
5.1.40.1070.01510.66
5.1.30.1060.01510.81
5.1.20.1190.01610.79
5.1.10.1160.01310.71
5.1.00.1200.01510.78
5.0.50.0580.01310.66
5.0.40.0750.01310.66
5.0.30.0710.01710.66
5.0.20.0860.01210.66
5.0.10.0540.00810.66
5.0.00.0810.01810.66
4.4.90.0620.01110.66
4.4.80.0350.01710.66
4.4.70.0650.01210.66
4.4.60.0380.01310.66
4.4.50.0420.01410.66
4.4.40.0530.01310.66
4.4.30.0510.00910.66
4.4.20.0750.01410.66
4.4.10.0380.01110.66
4.4.00.0410.01210.66
4.3.110.0800.00810.66
4.3.100.0470.01310.66
4.3.90.0760.00810.66
4.3.80.0700.01310.66
4.3.70.0800.01010.66
4.3.60.0710.01010.66
4.3.50.0420.01410.66
4.3.40.0670.01610.66
4.3.30.0350.01010.66
4.3.20.0320.01210.66
4.3.10.0340.00810.66
4.3.00.0010.01210.66

preferences:
42.99 ms | 401 KiB | 5 Q