3v4l.org

run code in 300+ PHP versions simultaneously
<?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)); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 4
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 4
Branch analysis from position: 30
Branch analysis from position: 4
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 4
Branch analysis from position: 30
Branch analysis from position: 4
Branch analysis from position: 23
Branch analysis from position: 27
Branch analysis from position: 18
filename:       /in/NX7AT
function name:  (null)
number of ops:  38
compiled vars:  !0 = $win, !1 = $lose, !2 = $i, !3 = $throw1, !4 = $throw2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->28
    7     4    >   INIT_FCALL                                               'rand'
          5        SEND_VAL                                                 1
          6        SEND_VAL                                                 2
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
    8     9        INIT_FCALL                                               'rand'
         10        SEND_VAL                                                 1
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !4, $10
   10    14        IS_EQUAL                                         ~12     !3, 1
         15      > JMPNZ_EX                                         ~12     ~12, ->18
         16    >   IS_EQUAL                                         ~13     !4, 1
         17        BOOL                                             ~12     ~13
         18    > > JMPZ                                                     ~12, ->27
   12    19    >   IS_EQUAL                                         ~14     !3, 1
         20      > JMPZ_EX                                          ~14     ~14, ->23
         21    >   IS_EQUAL                                         ~15     !4, 1
         22        BOOL                                             ~14     ~15
         23    > > JMPZ                                                     ~14, ->26
   14    24    >   PRE_INC                                                  !0
         25      > JMP                                                      ->27
   18    26    >   PRE_INC                                                  !1
    5    27    >   PRE_INC                                                  !2
         28    >   IS_SMALLER_OR_EQUAL                                      !2, 10000
         29      > JMPNZ                                                    ~19, ->4
   23    30    >   CONCAT                                           ~20     !0, '+'
         31        ECHO                                                     ~20
   24    32        ECHO                                                     !1
   25    33        ADD                                              ~21     !0, !1
         34        DIV                                              ~22     !0, ~21
         35        CONCAT                                           ~23     '+Proba%3D', ~22
         36        ECHO                                                     ~23
   26    37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.31 ms | 1405 KiB | 15 Q