3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $y=1; $last=0; $bdlat = 0.25 + 0.25 + 0.15; $rtbhs = array("Lieutenant", "F Lieutenant", "Captain", "Major ", "L Colonel", "Colonel", "B General"); $rtbh = 1; $base = 9275; $i=1; $S="\t| "; while (1) { echo $y . $S . $rtbhs[$rtbh] . $S . $i . $S . round(2700+($base*$bdlat)+$base) . $S . round((2700+($base*$bdlat)+$base)-$last) . "\n"; $last = round(2700+($base*$bdlat)+$base); $y++; if ($rtbh == 1) { $base+=440; } else if ($rtbh == 2) { $base+=495; } else if ($rtbh == 3) { $base+=265; } else if ($rtbh == 4) { $base+=470; } else if ($rtbh == 5) { $base+=590; } else if ($rtbh == 6) { $base+=650; } if ($rtbh == 1 && $i == 3) { $i=0; $base = 10600; $rtbh++; } else if ($rtbh == 2 && $i == 6) { $i=0; $base = 13515; $rtbh++; } else if ($rtbh == 3 && $i == 4) { $i=0; $base = 14650; $rtbh++; } else if ($rtbh == 4 && $i == 4) { $i=0; $base = 16520; $rtbh++; } else if ($rtbh == 5 && $i == 4) { $i=0; $base = 18805; $rtbh++; } else if ($rtbh == 6 && $i == 4) { break; } $i++; } echo "-------------------------------------------------\n"; $base = 9000; for ($i=1; $i <=21; $i++) { echo $i . $S . "Engineer" . $S . 0 . $S . round((600+($base*0.25)+$base)*0.91) . $S . round(((600+($base*0.25)+$base)*0.91)-$last) . "\n"; //echo $i . " - " . ((600+($base*0.25)+$base)*0.91) . " - " . (((600+($base*0.25)+$base)*0.91)-$last) . "\n"; $last = round((600+($base*0.25)+$base)*0.91); $y++; $base+=$base*0.06; }
based on UM4Kq
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
1 | F Lieutenant | 1 | 18004 | 18004 2 | F Lieutenant | 2 | 18730 | 726 3 | F Lieutenant | 3 | 19456 | 726 4 | Captain | 1 | 20190 | 734 5 | Captain | 2 | 21007 | 817 6 | Captain | 3 | 21824 | 817 7 | Captain | 4 | 22640 | 816 8 | Captain | 5 | 23457 | 817 9 | Captain | 6 | 24274 | 817 10 | Major | 1 | 25000 | 726 11 | Major | 2 | 25437 | 437 12 | Major | 3 | 25874 | 437 13 | Major | 4 | 26312 | 438 14 | L Colonel | 1 | 26873 | 561 15 | L Colonel | 2 | 27648 | 775 16 | L Colonel | 3 | 28424 | 776 17 | L Colonel | 4 | 29199 | 775 18 | Colonel | 1 | 29958 | 759 19 | Colonel | 2 | 30932 | 974 20 | Colonel | 3 | 31905 | 973 21 | Colonel | 4 | 32879 | 974 22 | B General | 1 | 33728 | 849 23 | B General | 2 | 34801 | 1073 24 | B General | 3 | 35873 | 1072 25 | B General | 4 | 36946 | 1073 ------------------------------------------------- 1 | Engineer | 0 | 10784 | -26163 2 | Engineer | 0 | 11398 | 614 3 | Engineer | 0 | 12049 | 651 4 | Engineer | 0 | 12739 | 690 5 | Engineer | 0 | 13471 | 732 6 | Engineer | 0 | 14246 | 775 7 | Engineer | 0 | 15068 | 822 8 | Engineer | 0 | 15939 | 871 9 | Engineer | 0 | 16863 | 924 10 | Engineer | 0 | 17842 | 979 11 | Engineer | 0 | 18880 | 1038 12 | Engineer | 0 | 19980 | 1100 13 | Engineer | 0 | 21146 | 1166 14 | Engineer | 0 | 22382 | 1236 15 | Engineer | 0 | 23692 | 1310 16 | Engineer | 0 | 25081 | 1389 17 | Engineer | 0 | 26553 | 1472 18 | Engineer | 0 | 28113 | 1560 19 | Engineer | 0 | 29767 | 1654 20 | Engineer | 0 | 31521 | 1754 21 | Engineer | 0 | 33379 | 1858