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); } /**********************************************/ $year = 2014; $limit = 2104; 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.60.0100.00718.15
8.3.50.0130.00822.85
8.3.40.0070.01118.84
8.3.30.0150.00919.21
8.3.20.0070.00320.28
8.3.10.0000.00921.99
8.3.00.0090.00018.01
8.2.180.0190.00618.02
8.2.170.0140.00322.96
8.2.160.0100.01320.52
8.2.150.0030.00624.18
8.2.140.0070.00424.66
8.2.130.0000.00926.16
8.2.120.0060.00321.15
8.2.110.0090.00322.44
8.2.100.0100.00319.77
8.2.90.0000.00919.38
8.2.80.0030.00617.97
8.2.70.0000.00917.61
8.2.60.0080.00318.15
8.2.50.0030.00718.07
8.2.40.0060.00318.47
8.2.30.0030.00618.30
8.2.20.0000.01017.95
8.2.10.0090.00018.25
8.2.00.0060.00317.89
8.1.280.0070.01425.92
8.1.270.0070.00423.96
8.1.260.0030.00626.35
8.1.250.0060.00328.09
8.1.240.0030.00724.00
8.1.230.0090.00319.20
8.1.220.0030.00617.74
8.1.210.0000.00918.77
8.1.200.0060.00317.35
8.1.190.0070.00317.35
8.1.180.0000.00918.10
8.1.170.0060.00318.59
8.1.160.0000.00822.20
8.1.150.0030.00618.98
8.1.140.0060.00317.59
8.1.130.0000.00917.98
8.1.120.0000.00817.68
8.1.110.0040.00417.47
8.1.100.0000.00817.64
8.1.90.0030.00617.49
8.1.80.0000.00917.48
8.1.70.0040.00417.57
8.1.60.0030.00617.66
8.1.50.0000.01017.64
8.1.40.0040.00417.67
8.1.30.0070.00317.62
8.1.20.0060.00317.60
8.1.10.0000.00917.65
8.1.00.0050.00517.48
8.0.300.0100.00018.77
8.0.290.0060.00316.63
8.0.280.0040.00418.48
8.0.270.0090.00017.26
8.0.260.0030.00617.27
8.0.250.0040.00416.98
8.0.240.0100.00016.91
8.0.230.0000.00917.03
8.0.220.0050.00516.86
8.0.210.0050.00316.89
8.0.200.0060.00316.99
8.0.190.0000.01016.91
8.0.180.0000.00916.84
8.0.170.0000.00916.89
8.0.160.0070.00716.82
8.0.150.0000.00816.78
8.0.140.0060.00316.77
8.0.130.0000.00713.34
8.0.120.0060.00316.90
8.0.110.0030.00616.76
8.0.100.0000.00816.86
8.0.90.0040.00416.89
8.0.80.0090.01116.84
8.0.70.0030.00616.79
8.0.60.0070.00316.91
8.0.50.0060.00316.79
8.0.30.0190.01116.86
8.0.20.0130.01317.40
8.0.10.0000.00916.91
8.0.00.0110.01816.75
7.4.330.0030.00315.19
7.4.320.0060.00316.52
7.4.300.0030.00516.46
7.4.290.0060.00316.47
7.4.280.0070.00316.56
7.4.270.0000.00916.56
7.4.260.0070.00716.52
7.4.250.0030.00616.31
7.4.240.0010.00716.59
7.4.230.0040.00416.65
7.4.220.0030.02016.41
7.4.210.0090.01316.51
7.4.200.0060.00316.46
7.4.160.0210.00716.36
7.4.150.0260.01217.40
7.4.140.0170.01517.86
7.4.130.0250.01216.70
7.4.120.0140.01416.40
7.4.110.0220.02216.51
7.4.100.0240.02216.54
7.4.90.0150.01216.58
7.4.80.0230.01119.39
7.4.70.0140.01716.49
7.4.60.0100.01316.44
7.4.50.0000.00516.31
7.4.40.0090.02816.54
7.4.30.0140.01216.43
7.4.00.0000.01814.68
7.3.330.0080.00013.43
7.3.320.0000.00713.45
7.3.310.0000.00916.23
7.3.300.0000.00916.37
7.3.290.0130.01016.33
7.3.280.0110.01316.27
7.3.270.0050.02317.40
7.3.260.0180.01416.59
7.3.240.0170.00816.46
7.3.230.0170.01016.66
7.3.210.0230.00316.38
7.3.200.0150.01216.66
7.3.190.0250.01116.33
7.3.180.0100.01016.25
7.3.170.0080.02016.42
7.3.160.0100.01316.41
7.2.330.0290.00916.67
7.2.320.0160.01416.64
7.2.310.0140.01416.64
7.2.300.0130.01016.64
7.2.290.0160.01616.75
7.2.00.0090.00619.41
7.1.200.0060.01015.73
7.1.100.0070.00718.04
7.1.70.0070.01016.82
7.1.60.0150.01219.40
7.1.50.0140.01017.04
7.0.200.0050.00516.85

preferences:
36.47 ms | 401 KiB | 5 Q