3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $win = 0; $lose = 0; for ($i=0;$i<=10000;$i++) { $throw1 = rand(1,2); // 1 = head, 2 = tail $throw2 = rand(1,2); if($throw1 == 1 or $throw2 == 1) { if($throw1==1 && $throw2 ==1) { $win++; } else { $lose++; } } } echo $win." "; echo $lose; echo " Proba=".($win/($win+$lose)); ?>
Output for 7.1.0
2454 4974 Proba=0.33037156704362
Output for 7.0.14
2552 4955 Proba=0.33994938057813
Output for 7.0.6
2502 4949 Proba=0.33579385317407
Output for 7.0.5
2480 5043 Proba=0.32965572245115
Output for 7.0.4
2502 4926 Proba=0.33683360258481
Output for 7.0.3
2503 5016 Proba=0.33289001196968
Output for 7.0.2
2509 4957 Proba=0.33605679078489
Output for 7.0.1
2522 4947 Proba=0.33766233766234
Output for 7.0.0
2477 4946 Proba=0.33369257712515
Output for 5.6.28
2487 5064 Proba=0.32936034962257
Output for 5.6.21
2527 4922 Proba=0.3392401664653
Output for 5.6.20
2474 4994 Proba=0.33128012854847
Output for 5.6.19
2525 4958 Proba=0.3374315114259
Output for 5.6.18
2536 4953 Proba=0.33862999065296
Output for 5.6.17
2459 5055 Proba=0.32725578919351
Output for 5.6.16
2455 4993 Proba=0.3296186895811
Output for 5.6.15
2432 4996 Proba=0.3274098007539
Output for 5.6.14
2548 5052 Proba=0.33526315789474
Output for 5.6.13
2523 4983 Proba=0.3361310951239
Output for 5.6.12
2524 5046 Proba=0.3334214002642
Output for 5.6.11
2528 5015 Proba=0.33514516770516
Output for 5.6.10
2469 5014 Proba=0.32994788186556
Output for 5.6.9
2554 4962 Proba=0.33980840872805
Output for 5.6.8
2480 5002 Proba=0.3314621758888
Output for 5.5.35
2515 4921 Proba=0.33821947283486
Output for 5.5.34
2493 5019 Proba=0.33186900958466
Output for 5.5.33
2543 5044 Proba=0.33517859496507
Output for 5.5.32
2442 5065 Proba=0.32529639003597
Output for 5.5.31
2482 5013 Proba=0.33115410273516
Output for 5.5.30
2529 4985 Proba=0.3365717327655
Output for 5.5.29
2587 4933 Proba=0.34401595744681
Output for 5.5.28
2514 4946 Proba=0.33699731903485
Output for 5.5.27
2541 5038 Proba=0.33526850507983
Output for 5.5.26
2538 5014 Proba=0.33606991525424
Output for 5.5.25
2475 5044 Proba=0.32916611251496
Output for 5.3.7, 5.5.24
2491 4966 Proba=0.33404854499128
Output for 5.4.45
2488 5038 Proba=0.33058729736912
Output for 5.4.44
2516 4976 Proba=0.33582487987186
Output for 5.4.43
2457 5025 Proba=0.32838813151564
Output for 5.4.42
2520 4961 Proba=0.33685336185002
Output for 5.4.41
2494 4984 Proba=0.33351163412677
Output for 5.4.40
2522 5003 Proba=0.33514950166113
Output for 5.4.39
2558 4892 Proba=0.34335570469799
Output for 5.4.38
2523 4969 Proba=0.33675920982381
Output for 5.4.37
2500 4990 Proba=0.33377837116155
Output for 5.4.36
2503 5018 Proba=0.33280148916368
Output for 5.4.35
2478 4989 Proba=0.33186018481318
Output for 5.4.34
2474 5001 Proba=0.33096989966555
Output for 5.4.32
2500 5016 Proba=0.3326237360298
Output for 5.4.31
2528 5024 Proba=0.33474576271186
Output for 5.4.30
2505 5030 Proba=0.33244857332449
Output for 5.4.29
2523 4996 Proba=0.33554994015162
Output for 5.4.28
2511 5019 Proba=0.33346613545817
Output for 5.4.27
2573 4971 Proba=0.341065747614
Output for 5.4.26
2454 5061 Proba=0.32654690618762
Output for 5.4.25
2608 4926 Proba=0.34616405627821
Output for 5.3.21, 5.4.24
2534 4944 Proba=0.33886065792993
Output for 5.4.23
2536 4985 Proba=0.33718920356336
Output for 5.4.22
2389 5141 Proba=0.31726427622842
Output for 5.4.21
2451 5023 Proba=0.32793684773883
Output for 5.4.20
2500 5058 Proba=0.33077533739084
Output for 5.4.19
2564 4936 Proba=0.34186666666667
Output for 5.4.18
2537 4970 Proba=0.3379512455042
Output for 5.4.17
2441 5144 Proba=0.32181938035597
Output for 5.4.16
2509 5027 Proba=0.33293524416136
Output for 5.4.15
2562 5012 Proba=0.33826247689464
Output for 5.4.14
2480 5061 Proba=0.32886885028511
Output for 5.4.13
2459 5040 Proba=0.32791038805174
Output for 5.4.12
2455 5042 Proba=0.32746431906096
Output for 5.4.11
2560 4985 Proba=0.33929754804506
Output for 5.4.10
2464 4985 Proba=0.33078265538999
Output for 5.4.9
2564 4925 Proba=0.34236880758446
Output for 5.4.8
2588 4940 Proba=0.34378320935175
Output for 5.4.7
2500 5010 Proba=0.33288948069241
Output for 5.4.6
2424 5090 Proba=0.32259781740751
Output for 5.4.5
2482 5050 Proba=0.32952734997345
Output for 5.4.4
2506 4930 Proba=0.33700914470145
Output for 5.4.3
2487 4945 Proba=0.33463401506997
Output for 5.4.2
2464 5086 Proba=0.32635761589404
Output for 5.4.1
2553 4896 Proba=0.34273056786146
Output for 5.4.0
2553 4930 Proba=0.34117332620607
Output for 5.3.29
2508 4973 Proba=0.33524929822216
Output for 5.3.28
2535 4994 Proba=0.33669810067738
Output for 5.3.27
2490 5074 Proba=0.32919090428345
Output for 5.3.26
2536 4999 Proba=0.33656270736563
Output for 5.3.25
2502 4997 Proba=0.33364448593146
Output for 5.3.24
2472 5004 Proba=0.330658105939
Output for 5.3.23
2518 5008 Proba=0.33457347860749
Output for 5.3.22
2494 5016 Proba=0.33209054593875
Output for 5.3.20
2465 5040 Proba=0.32844770153231
Output for 5.3.19
2538 4957 Proba=0.33862575050033
Output for 5.3.18
2518 4991 Proba=0.33533093620988
Output for 5.3.17
2541 4939 Proba=0.33970588235294
Output for 5.3.16
2520 4938 Proba=0.33789219629928
Output for 5.3.15
2503 5044 Proba=0.33165496223665
Output for 5.3.14
2523 5028 Proba=0.33412793007549
Output for 5.3.13
2568 4864 Proba=0.34553283100108
Output for 5.3.12
2437 5034 Proba=0.32619461919422
Output for 5.3.11
2471 5008 Proba=0.33039176360476
Output for 5.3.10
2463 5012 Proba=0.3294983277592
Output for 5.3.9
2523 5024 Proba=0.33430502186299
Output for 5.3.8
2553 5017 Proba=0.33725231175694
Output for 5.3.6
2480 5035 Proba=0.33000665335995
Output for 5.3.5
2516 5046 Proba=0.33271621264216
Output for 5.3.4
2489 4987 Proba=0.33293204922418
Output for 5.3.3
2495 4987 Proba=0.33346698743651
Output for 5.3.2
2532 4990 Proba=0.33661260303111
Output for 5.3.1
2478 5024 Proba=0.33031191682218
Output for 5.3.0
2484 5045 Proba=0.32992429273476
Output for 5.2.17
2459 5008 Proba=0.32931565555109
Output for 5.2.16
2505 5025 Proba=0.33266932270916
Output for 5.2.15
2436 4994 Proba=0.3278600269179
Output for 5.2.14
2502 4998 Proba=0.3336
Output for 5.2.13
2556 4928 Proba=0.34152859433458
Output for 5.2.12
2468 5054 Proba=0.32810422759904
Output for 5.2.11
2522 5037 Proba=0.3336420161397
Output for 5.2.10
2431 5050 Proba=0.32495655661008
Output for 5.2.9
2503 4945 Proba=0.33606337271751
Output for 5.2.8
2540 4999 Proba=0.33691471017376
Output for 5.2.7
2518 4976 Proba=0.33600213504137
Output for 5.2.6
2467 5007 Proba=0.33007760235483
Output for 5.2.5
2481 5038 Proba=0.32996409096954
Output for 5.2.4
2508 4967 Proba=0.33551839464883
Output for 5.2.3
2463 4938 Proba=0.33279286582894
Output for 5.2.2
2545 4904 Proba=0.3416565982011
Output for 5.2.1
2508 5018 Proba=0.33324475152804
Output for 5.2.0
2472 5002 Proba=0.33074658817233
Output for 5.1.6
2537 4990 Proba=0.33705327487711
Output for 5.1.5
2476 5025 Proba=0.33008932142381
Output for 5.1.4
2456 5033 Proba=0.32794765656296
Output for 5.1.3
2494 5034 Proba=0.33129649309245
Output for 5.1.2
2444 4992 Proba=0.32867132867133
Output for 5.1.1
2509 5012 Proba=0.33359925541816
Output for 5.1.0
2573 4984 Proba=0.34047902606855
Output for 5.0.5
2488 4986 Proba=0.33288734278833
Output for 5.0.4
2510 4967 Proba=0.33569613481343
Output for 5.0.3
2492 5005 Proba=0.33239962651727
Output for 5.0.2
2475 4922 Proba=0.3345951061241
Output for 5.0.1
2475 4983 Proba=0.33185840707965
Output for 5.0.0
2542 4998 Proba=0.33713527851459
Output for 4.4.9
2513 4996 Proba=0.33466506858437
Output for 4.4.8
2504 4910 Proba=0.33773941192339
Output for 4.4.7
2527 5005 Proba=0.33550185873606
Output for 4.4.6
2564 4988 Proba=0.33951271186441
Output for 4.4.5
2477 5012 Proba=0.33075176926158
Output for 4.4.4
2450 4952 Proba=0.33099162388544
Output for 4.4.3
2488 5016 Proba=0.33155650319829
Output for 4.4.2
2382 5059 Proba=0.32011826367424
Output for 4.4.1
2448 4993 Proba=0.32898803924204
Output for 4.4.0
2582 4993 Proba=0.34085808580858
Output for 4.3.11
2473 5056 Proba=0.32846327533537
Output for 4.3.10
2499 5021 Proba=0.33231382978723
Output for 4.3.9
2536 4974 Proba=0.33768308921438
Output for 4.3.8
2473 5007 Proba=0.33061497326203
Output for 4.3.7
2476 5008 Proba=0.33083912346339
Output for 4.3.6
2480 5041 Proba=0.32974338518814
Output for 4.3.5
2537 4997 Proba=0.33674011149456
Output for 4.3.4
2560 4942 Proba=0.34124233537723
Output for 4.3.3
2564 4920 Proba=0.3425975414217
Output for 4.3.2
2545 4878 Proba=0.34285329381652
Output for 4.3.1
2459 4973 Proba=0.33086652314316
Output for 4.3.0
2544 5013 Proba=0.33664152441445