3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $num = array(); $n = 0; $sum = 0; $target = 50000; $low = 500; $high = 15000; while($n < 5) { do { $t = rand($low, $high); }while($sum + $t >= $target); $num[] = $t; $sum += $t; $n++; } $num[] = $target - $sum; rsort($num); echo ''.$num[0].' <br />'; echo ''.$num[1].' <br />'; echo ''.$num[2].' <br />'; echo ''.$num[3].' <br />'; echo ''.$num[4].' <br />'; echo ''.$num[5].' <br />';
Output for 7.2.6
13353 <br />11966 <br />10903 <br />7333 <br />3887 <br />2558 <br />
Output for 7.2.0
13732 <br />10931 <br />9000 <br />8123 <br />7550 <br />664 <br />
Output for 7.1.10
14641 <br />13875 <br />9254 <br />5650 <br />4733 <br />1847 <br />
Output for 7.1.7
18593 <br />12050 <br />11867 <br />2773 <br />2374 <br />2343 <br />
Output for 7.1.6
14752 <br />11653 <br />10585 <br />5991 <br />4265 <br />2754 <br />
Output for 7.1.5
12913 <br />8038 <br />8025 <br />7284 <br />7265 <br />6475 <br />
Output for 7.1.4
13100 <br />11595 <br />9157 <br />9142 <br />4455 <br />2551 <br />
Output for 7.1.3
28027 <br />8377 <br />6676 <br />4475 <br />1389 <br />1056 <br />
Output for 7.1.2
13159 <br />12552 <br />11190 <br />6990 <br />3705 <br />2404 <br />
Output for 7.1.1
14502 <br />11964 <br />8805 <br />7323 <br />4789 <br />2617 <br />
Output for 7.1.0
13324 <br />10187 <br />9590 <br />7922 <br />5976 <br />3001 <br />
Output for 7.0.20
12677 <br />12169 <br />10128 <br />9256 <br />5047 <br />723 <br />
Output for 7.0.19
13583 <br />12736 <br />12689 <br />5874 <br />3518 <br />1600 <br />
Output for 7.0.18
14340 <br />12994 <br />10701 <br />6569 <br />5293 <br />103 <br />
Output for 7.0.17
14436 <br />11802 <br />10522 <br />9544 <br />3066 <br />630 <br />
Output for 7.0.16
14911 <br />14190 <br />14154 <br />5791 <br />537 <br />417 <br />
Output for 7.0.15
24648 <br />7488 <br />6978 <br />5441 <br />3688 <br />1757 <br />
Output for 7.0.14
30309 <br />8497 <br />5609 <br />4219 <br />791 <br />575 <br />
Output for 7.0.13
12592 <br />11883 <br />11737 <br />11596 <br />1666 <br />526 <br />
Output for 7.0.12
27884 <br />8247 <br />7106 <br />3796 <br />2271 <br />696 <br />
Output for 7.0.11
29471 <br />6217 <br />5956 <br />4534 <br />2757 <br />1065 <br />
Output for 7.0.10
11265 <br />11007 <br />10495 <br />7949 <br />6882 <br />2402 <br />
Output for 7.0.9
31081 <br />6515 <br />5403 <br />2862 <br />2502 <br />1637 <br />
Output for 7.0.8
13872 <br />13770 <br />12877 <br />3891 <br />3107 <br />2483 <br />
Output for 7.0.7
26660 <br />13766 <br />4532 <br />2296 <br />1477 <br />1269 <br />
Output for 7.0.6
13526 <br />11160 <br />10827 <br />6922 <br />4837 <br />2728 <br />
Output for 7.0.5
14974 <br />14037 <br />11616 <br />8492 <br />857 <br />24 <br />
Output for 7.0.4
15909 <br />13672 <br />6473 <br />5948 <br />5310 <br />2688 <br />
Output for 7.0.3
13386 <br />9741 <br />8041 <br />7744 <br />7170 <br />3918 <br />
Output for 7.0.2
17507 <br />14622 <br />7839 <br />5675 <br />3531 <br />826 <br />
Output for 7.0.1
13028 <br />12137 <br />7892 <br />7848 <br />7366 <br />1729 <br />
Output for 7.0.0
21093 <br />10130 <br />9842 <br />5682 <br />2239 <br />1014 <br />
Output for hhvm-3.15.4
16813 <br />9274 <br />8400 <br />7867 <br />5553 <br />2093 <br />
Output for 5.6.30
14619 <br />13259 <br />10834 <br />7933 <br />2011 <br />1344 <br />
Output for 5.6.29
14449 <br />10375 <br />9946 <br />9548 <br />5146 <br />536 <br />
Output for 5.6.28
20408 <br />9547 <br />8387 <br />7475 <br />3469 <br />714 <br />
Output for 5.6.27
14643 <br />13984 <br />8866 <br />5982 <br />5529 <br />996 <br />
Output for 5.6.26
12965 <br />12234 <br />11475 <br />6711 <br />5672 <br />943 <br />
Output for 5.6.25
11636 <br />10931 <br />9804 <br />8443 <br />5259 <br />3927 <br />
Output for 5.6.24
14113 <br />13938 <br />8456 <br />6982 <br />5573 <br />938 <br />
Output for 5.6.23
14225 <br />13562 <br />8968 <br />5957 <br />4595 <br />2693 <br />
Output for 5.6.22
14797 <br />13181 <br />13001 <br />5949 <br />2525 <br />547 <br />
Output for 5.6.21
23613 <br />12623 <br />5494 <br />3773 <br />3645 <br />852 <br />
Output for 5.6.20
32470 <br />8257 <br />5725 <br />1613 <br />1140 <br />795 <br />
Output for 5.6.19
12362 <br />12188 <br />9856 <br />8965 <br />4558 <br />2071 <br />
Output for 5.6.18
29710 <br />7514 <br />7316 <br />2435 <br />2020 <br />1005 <br />
Output for 5.6.17
14108 <br />13455 <br />8776 <br />8507 <br />3631 <br />1523 <br />
Output for 5.6.16
14162 <br />13163 <br />11436 <br />6660 <br />2982 <br />1597 <br />
Output for 5.6.15
20085 <br />9843 <br />6860 <br />6457 <br />6144 <br />611 <br />
Output for 5.6.14
11645 <br />11273 <br />10591 <br />8536 <br />4338 <br />3617 <br />
Output for 5.6.13
13626 <br />11474 <br />9622 <br />8539 <br />3742 <br />2997 <br />
Output for 5.6.12
17636 <br />13300 <br />10707 <br />4800 <br />2189 <br />1368 <br />
Output for 5.6.11
13298 <br />10437 <br />9650 <br />9525 <br />4662 <br />2428 <br />
Output for 5.6.10
15328 <br />9803 <br />9307 <br />8778 <br />5818 <br />966 <br />
Output for 5.6.9
14500 <br />13040 <br />10712 <br />9662 <br />1382 <br />704 <br />
Output for 5.6.8
15437 <br />14525 <br />7699 <br />7325 <br />4104 <br />910 <br />
Output for 5.6.7
14833 <br />10853 <br />9448 <br />7337 <br />4046 <br />3483 <br />
Output for 5.6.6
13628 <br />8779 <br />8268 <br />8208 <br />6379 <br />4738 <br />
Output for 5.6.5
23327 <br />10543 <br />6362 <br />4802 <br />4135 <br />831 <br />
Output for 5.6.4
13445 <br />10223 <br />10172 <br />7462 <br />5371 <br />3327 <br />
Output for 5.6.3
13873 <br />12663 <br />10442 <br />6174 <br />5147 <br />1701 <br />
Output for 5.6.2
14588 <br />9500 <br />8577 <br />7132 <br />6641 <br />3562 <br />
Output for 5.6.1
13717 <br />12730 <br />8745 <br />6225 <br />5551 <br />3032 <br />
Output for 5.6.0
22317 <br />9019 <br />7566 <br />5872 <br />2639 <br />2587 <br />