# 3v4l.org

run code in 150+ php & hhvm versions
```<?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 = 2015; main(\$year, \$limit); ?>```
Output for 4.3.0 - 5.6.25, 7.0.0 - 7.1.0RC3
2456688.4201248689 174.0 0.0 2456703.1854193169 174.5 0.5 2456717.9507137649 175.0 0.0 2456732.7160082129 175.5 0.5 2456747.4813026614 176.0 0.0 2456762.2465971098 176.5 0.5 2456777.0118915578 177.0 0.0 2456791.7771860058 177.5 0.5 2456806.5424804548 178.0 0.0 2456821.3077749033 178.5 0.5 2456836.0730693517 179.0 0.0 2456850.8383638002 179.5 0.5 2456865.6036582491 180.0 0.0 2456880.3689526976 180.5 0.5 2456895.1342471461 181.0 0.0 2456909.8995415955 181.5 0.5 2456924.6648360440 182.0 0.0 2456939.4301304929 182.5 0.5 2456954.1954249418 183.0 0.0 2456968.9607193908 183.5 0.5 2456983.7260138402 184.0 0.0 2456998.4913082886 184.5 0.5 2457013.2566027381 185.0 0.0 2457028.0218971875 185.5 0.5 2457042.7871916364 186.0 0.0 2457057.5524860858 186.5 0.5
Output for hhvm-3.10.0 - 3.12.0
2456688.4201248689 174.0 0.0 2456703.1854193169 174.5 0.5 2456717.9507137649 175.0 0.0 2456732.7160082129 175.5 0.5 2456747.4813026614 176.0 0.0 2456762.2465971094 176.5 0.5 2456777.0118915578 177.0 0.0 2456791.7771860063 177.5 0.5 2456806.5424804548 178.0 0.0 2456821.3077749033 178.5 0.5 2456836.0730693517 179.0 0.0 2456850.8383638002 179.5 0.5 2456865.6036582491 180.0 0.0 2456880.3689526976 180.5 0.5 2456895.1342471465 181.0 0.0 2456909.8995415950 181.5 0.5 2456924.6648360440 182.0 0.0 2456939.4301304929 182.5 0.5 2456954.1954249418 183.0 0.0 2456968.9607193908 183.5 0.5 2456983.7260138397 184.0 0.0 2456998.4913082891 184.5 0.5 2457013.2566027381 185.0 0.0 2457028.0218971875 185.5 0.5 2457042.7871916364 186.0 0.0 2457057.5524860858 186.5 0.5