3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** results in hhvm differ from php's **/ function main($year, $limit) { $PERIOD = 0.080905722906849315068493150684932; $PERIOD_HALF = 0.040452861453424657534246575342; //printf("PERIOD : %.33f\n", $PERIOD); //printf("PERIOD_HALF: %.33f\n", $PERIOD_HALF); $old = 0; do { $year += $PERIOD; $jde = calc($year, 0.0); if ($old != 0) { $diff = $jde - $old; if ($diff > 40) { $year2 = $year - $PERIOD_HALF; $jde2 = calc($year2, 0.0); $jde2 = calc($year2, 0.5); } } $jde = calc($year, 0.5); $old = $jde; } while ($year <= $limit); } function calc($year, $phase) { $k = floor(($year - 2000) * 12.3685); $k += $phase; $T = $k / 1236.85; $jde = 2451550.09766 + 29.530588861 * $k + (0.00015437 + (-0.000000150 + 0.00000000073 * $T) * $T) * $T * $T; //Print by changing %.12f from %.1f ~ %12.f or more //It's not the problem of printf/sprintf. But it's much more about arithmetic calculation. printf("%.10f %.1f %.1f\n", $jde, $k, $phase); } /**********************************************/ if (count($argv) != 3) { print " start_year and end_year could be any calendar year Usage: php $argv[0] start_year end_year ex : php $argv[0] 2014 2030 "; exit; } $year = $argv[1]; $limit = $argv[2]; if($year > $limit) { print " end_year($limit) must be greater than or equal to start_year($year) "; exit; } if($year < -13000 || $limit > 17000) { print " Range: -13000 ~ 17000 "; exit; } main($year, $limit); ?>

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.70.0110.00716.63
8.3.60.0120.00316.63
8.3.50.0120.00722.84
8.3.40.0040.01119.02
8.3.30.0070.01318.92
8.3.20.0070.00020.29
8.3.10.0000.00821.77
8.3.00.0040.00419.67
8.2.180.0060.00916.75
8.2.170.0110.01122.96
8.2.160.0090.00920.38
8.2.150.0000.00724.18
8.2.140.0080.00024.66
8.2.130.0110.00326.16
8.2.120.0080.00020.91
8.2.110.0030.00621.11
8.2.100.0120.00017.63
8.2.90.0040.00419.21
8.2.80.0000.00817.97
8.2.70.0030.00617.75
8.2.60.0030.00717.93
8.2.50.0060.00318.07
8.2.40.0060.00318.22
8.2.30.0000.00718.23
8.2.20.0040.00417.87
8.2.10.0030.00618.04
8.2.00.0060.00317.77
8.1.280.0100.00725.92
8.1.270.0000.00923.84
8.1.260.0050.00326.35
8.1.250.0110.00428.09
8.1.240.0060.00321.29
8.1.230.0070.00417.76
8.1.220.0040.00417.76
8.1.210.0060.00318.77
8.1.200.0000.01017.22
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0000.00820.27
8.1.160.0050.00222.10
8.1.150.0040.00418.91
8.1.140.0040.00417.44
8.1.130.0050.00317.74
8.1.120.0070.00017.46
8.1.110.0040.00417.34
8.1.100.0040.00417.34
8.1.90.0080.00017.41
8.1.80.0030.00317.30
8.1.70.0030.00317.38
8.1.60.0040.00417.49
8.1.50.0000.00817.50
8.1.40.0040.00417.51
8.1.30.0000.00817.64
8.1.20.0000.00817.70
8.1.10.0030.00617.44
8.1.00.0030.00617.47
8.0.300.0080.00018.77
8.0.290.0040.00416.75
8.0.280.0050.00318.29
8.0.270.0000.00817.23
8.0.260.0070.00017.23
8.0.250.0000.00716.92
8.0.240.0000.00816.95
8.0.230.0000.00716.88
8.0.220.0070.00016.87
8.0.210.0000.00716.84
8.0.200.0000.00717.05
8.0.190.0030.00717.06
8.0.180.0030.00516.97
8.0.170.0080.00016.93
8.0.160.0000.00716.95
8.0.150.0040.00416.81
8.0.140.0040.00416.79
8.0.130.0030.00313.39
8.0.120.0030.00616.79
8.0.110.0000.00816.87
8.0.100.0020.00516.80
8.0.90.0000.00716.85
8.0.80.0130.00916.85
8.0.70.0040.00416.78
8.0.60.0040.00416.82
8.0.50.0000.00716.81
8.0.30.0050.01517.04
8.0.20.0150.00317.40
8.0.10.0000.00716.86
8.0.00.0100.00816.82
7.4.330.0030.00315.07
7.4.320.0000.00716.63
7.4.300.0030.00316.47
7.4.290.0040.00416.58
7.4.280.0040.00416.51
7.4.270.0030.00316.48
7.4.260.0000.00716.46
7.4.250.0000.00716.46
7.4.240.0020.00516.56
7.4.230.0030.00316.37
7.4.220.0100.00716.58
7.4.210.0110.00416.64
7.4.200.0030.00316.33
7.4.160.0050.01016.40
7.4.150.0130.00717.40
7.4.140.0120.00617.86
7.4.130.0060.01016.49
7.4.120.0030.01416.63
7.4.110.0030.01316.55
7.4.100.0090.00916.56
7.4.90.0030.01816.61
7.4.80.0030.01219.39
7.4.70.0110.01116.39
7.4.60.0100.00716.48
7.4.50.0060.00316.63
7.4.40.0090.01216.45
7.4.30.0160.00316.57
7.4.00.0030.01314.82
7.3.330.0060.00013.28
7.3.320.0060.00013.44
7.3.310.0030.00316.34
7.3.300.0000.00716.45
7.3.290.0100.01016.32
7.3.280.0090.00716.40
7.3.270.0090.01617.40
7.3.260.0140.00416.55
7.3.250.0110.00616.56
7.3.240.0060.01516.43
7.3.230.0090.00616.46
7.3.210.0100.00616.38
7.3.200.0030.02019.39
7.3.190.0080.00816.46
7.3.180.0100.00716.57
7.3.170.0100.00616.65
7.3.160.0100.01016.48
7.2.330.0100.00716.71
7.2.320.0040.01516.50
7.2.310.0140.01016.47
7.2.300.0040.01416.79
7.2.290.0130.00716.82
7.2.00.0190.01119.30
7.1.100.0250.00717.20
7.1.70.0040.00417.15
7.1.60.0040.00819.40
7.1.50.0120.01216.97
7.1.00.0030.07722.37
7.0.200.0070.00316.63
7.0.140.0000.07721.95
7.0.110.0070.05320.09
7.0.100.0200.06720.02
7.0.90.0130.03719.95
7.0.80.0070.08719.89
7.0.70.0030.04719.86
7.0.60.0130.07319.92
7.0.50.0130.07019.99
7.0.40.0100.07019.88
7.0.30.0200.06319.82
7.0.20.0100.04719.73
7.0.10.0100.08019.79
7.0.00.0130.07719.72
5.6.280.0070.07020.91
5.6.260.0000.07020.61
5.6.250.0100.07320.74
5.6.240.0030.05320.68
5.6.230.0070.05320.70
5.6.220.0100.05720.62
5.6.210.0070.06020.63
5.6.200.0170.06020.64
5.6.190.0030.07720.60
5.6.180.0070.08020.66
5.6.170.0100.08320.66
5.6.160.0100.08020.66
5.6.150.0070.07320.62
5.6.140.0100.07720.57
5.6.130.0070.08720.61
5.6.120.0100.08020.68
5.6.110.0100.08320.64
5.6.100.0030.09020.46
5.6.90.0030.07720.69
5.6.80.0030.07720.03
5.6.70.0070.08020.02
5.6.60.0000.08319.97
5.6.50.0000.08719.92
5.6.40.0030.04719.94
5.6.30.0070.07719.93
5.6.20.0070.08320.02
5.6.10.0030.06720.07
5.6.00.0030.04719.98
5.5.380.0070.07317.70
5.5.370.0130.07317.73
5.5.360.0030.08017.58
5.5.350.0030.08017.54
5.5.340.0100.04717.93
5.5.330.0030.07718.05
5.5.320.0030.05717.96
5.5.310.0000.04717.93
5.5.300.0070.05018.22
5.5.290.0100.06717.96
5.5.280.0070.07718.22
5.5.270.0000.08717.93
5.5.260.0030.08318.07
5.5.250.0070.04717.75
5.5.240.0000.05017.22
5.5.230.0000.08717.52
5.5.220.0030.07717.21
5.5.210.0000.05717.30
5.5.200.0000.07717.59
5.5.190.0070.06717.45
5.5.180.0030.07717.24
5.5.160.0030.06317.28
5.5.150.0070.07717.48
5.5.140.0070.07317.42
5.5.130.0130.04717.60
5.5.120.0030.08017.60
5.5.110.0100.07717.39
5.5.100.0070.04717.08
5.5.90.0070.07317.21
5.5.80.0130.06317.08
5.5.70.0130.07017.34
5.5.60.0030.07717.47
5.5.50.0030.06717.16
5.5.40.0070.07717.15
5.5.30.0030.07717.32
5.5.20.0070.06717.38
5.5.10.0030.06717.29
5.5.00.0130.07017.18
5.4.450.0030.05319.51
5.4.440.0070.08319.55
5.4.430.0000.04319.52
5.4.420.0030.04719.46
5.4.410.0030.07019.42
5.4.400.0030.07319.10
5.4.390.0030.07719.23
5.4.380.0100.07018.99
5.4.370.0070.04718.98
5.4.360.0030.07019.04
5.4.350.0100.07719.25
5.4.340.0070.07018.95
5.4.320.0130.03719.23
5.4.310.0030.07719.01
5.4.300.0100.07019.23
5.4.290.0030.08319.01
5.4.280.0070.06319.01
5.4.270.0100.04319.33
5.4.260.0030.08019.31
5.4.250.0030.07719.15
5.4.240.0030.05019.05
5.4.230.0170.06319.01
5.4.220.0070.07319.01
5.4.210.0100.07019.33
5.4.200.0030.07319.36
5.4.190.0130.05718.96
5.4.180.0170.06718.98
5.4.170.0000.08019.15
5.4.160.0170.06719.00
5.4.150.0100.07718.99
5.4.140.0070.07716.39
5.4.130.0100.05016.60
5.4.120.0100.03716.43
5.4.110.0000.04016.37
5.4.100.0070.05716.55
5.4.90.0030.03316.63
5.4.80.0070.03316.36
5.4.70.0070.03016.70
5.4.60.0030.03316.49
5.4.50.0030.05016.30
5.4.40.0000.03716.34
5.4.30.0000.04016.42
5.4.20.0070.03016.44
5.4.10.0070.03316.43
5.4.00.0030.03316.00
5.3.290.0030.07714.66
5.3.280.0070.07314.70
5.3.270.0000.07314.75
5.3.260.0070.07714.74
5.3.250.0070.07714.48
5.3.240.0070.07014.64
5.3.230.0070.07314.84
5.3.220.0070.04014.62
5.3.210.0000.04314.59
5.3.200.0070.03714.67
5.3.190.0030.03714.55
5.3.180.0070.04014.71
5.3.170.0000.04714.57
5.3.160.0100.03014.60
5.3.150.0030.03714.57
5.3.140.0030.03714.52
5.3.130.0100.03014.41
5.3.120.0070.03714.52
5.3.110.0000.04014.41
5.3.100.0070.04314.18
5.3.90.0000.04314.25
5.3.80.0000.04314.05
5.3.70.0070.04014.05
5.3.60.0000.04314.07
5.3.50.0000.06314.02
5.3.40.0130.06014.10
5.3.30.0030.03313.94
5.3.20.0130.02313.73
5.3.10.0100.06313.71
5.3.00.0030.03713.50
5.2.170.0000.03011.21
5.2.160.0070.02311.16
5.2.150.0030.04011.23
5.2.140.0000.03311.16
5.2.130.0070.03711.34
5.2.120.0000.05011.19
5.2.110.0070.04311.24
5.2.100.0030.03011.24
5.2.90.0070.02010.97
5.2.80.0000.03311.07
5.2.70.0030.04311.18
5.2.60.0000.03011.04
5.2.50.0000.03311.17
5.2.40.0000.03011.03
5.2.30.0000.05711.01
5.2.20.0000.03010.99
5.2.10.0030.02710.89
5.2.00.0030.03010.77
5.1.60.0070.01710.02
5.1.50.0030.0239.98
5.1.40.0000.0239.96
5.1.30.0030.02710.43
5.1.20.0000.02710.34
5.1.10.0070.03310.09
5.1.00.0000.02710.34
5.0.50.0000.0239.73
5.0.40.0000.0209.73
5.0.30.0000.0309.73
5.0.20.0030.0179.73
5.0.10.0030.0179.73
5.0.00.0000.0309.73
4.4.90.0000.0179.73
4.4.80.0030.0179.73
4.4.70.0000.0179.73
4.4.60.0000.0179.73
4.4.50.0070.0239.73
4.4.40.0000.0239.73
4.4.30.0000.0239.73
4.4.20.0000.0239.73
4.4.10.0000.0339.73
4.4.00.0000.0279.73
4.3.110.0000.0139.73
4.3.100.0000.0179.73
4.3.90.0000.0139.73
4.3.80.0000.0309.73
4.3.70.0000.0139.73
4.3.60.0000.0139.73
4.3.50.0000.0239.73
4.3.40.0000.0239.73
4.3.30.0070.0179.73
4.3.20.0000.0179.73
4.3.10.0000.0179.73
4.3.00.0000.0179.73

preferences:
50.25 ms | 401 KiB | 5 Q