3v4l.org

run code in 300+ PHP versions simultaneously
<?php $roll = 0; $rollCount = 0; $total = 0; $weapon = 2; $armor = 4; $critroll = 0; $critChance = 70; $crit = 2; do { $roll = rand(1, 10+$weapon); $critroll = rand(1,100); $rollCount += 1; print "<i>----------------------------</i><br/>"; print "<i>---Fighter A fires shot ".$rollCount."---</i><br/>"; echo "The crit roll is ".$critroll." vs ".$critChance."<br/>"; if ($critroll >= $critChance){ echo "Fighter A shoots a critical blast dealing <b>".$roll*$crit."</b>!"."<br/>"; echo "<i>----------------------------</i><br/>"; $total = ($roll*$crit) + $total; }elseif ($roll <= $armor ) { echo "Fighter A shoots a glancing blow of ".$roll." against the target's ".$armor." armor, dealing <b>0</b>!". "<br/>"; $roll = 0; echo "<i>----------------------------</i><br/>"; $total = $roll + $total; } else { $roll = $roll; echo "Fighter A shoots for <b>".$roll."</b>!" . "<br/>"; echo "<i>----------------------------</i><br/>"; $total = $roll + $total; } } while ($roll != 10);{ echo "The round is over. "; echo "We rolled " . $rollCount . " times and obtained a 10!" . "<br/>"; echo "Total damage dealt: <b>" . $total."</b>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 41
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 8
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 54
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 8
Branch analysis from position: 64
Branch analysis from position: 8
filename:       /in/VkGLS
function name:  (null)
number of ops:  73
compiled vars:  !0 = $roll, !1 = $rollCount, !2 = $total, !3 = $weapon, !4 = $armor, !5 = $critroll, !6 = $critChance, !7 = $crit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        ASSIGN                                                   !1, 0
    4     2        ASSIGN                                                   !2, 0
    5     3        ASSIGN                                                   !3, 2
    6     4        ASSIGN                                                   !4, 4
    7     5        ASSIGN                                                   !5, 0
    8     6        ASSIGN                                                   !6, 70
    9     7        ASSIGN                                                   !7, 2
   12     8    >   INIT_FCALL                                               'rand'
          9        SEND_VAL                                                 1
         10        ADD                                              ~16     10, !3
         11        SEND_VAL                                                 ~16
         12        DO_ICALL                                         $17     
         13        ASSIGN                                                   !0, $17
   13    14        INIT_FCALL                                               'rand'
         15        SEND_VAL                                                 1
         16        SEND_VAL                                                 100
         17        DO_ICALL                                         $19     
         18        ASSIGN                                                   !5, $19
   14    19        ASSIGN_OP                                     1          !1, 1
   15    20        ECHO                                                     '%3Ci%3E----------------------------%3C%2Fi%3E%3Cbr%2F%3E'
   16    21        CONCAT                                           ~22     '%3Ci%3E---Fighter+A+fires+shot+', !1
         22        CONCAT                                           ~23     ~22, '---%3C%2Fi%3E%3Cbr%2F%3E'
         23        ECHO                                                     ~23
   17    24        CONCAT                                           ~24     'The+crit+roll+is+', !5
         25        CONCAT                                           ~25     ~24, '+vs+'
         26        CONCAT                                           ~26     ~25, !6
         27        CONCAT                                           ~27     ~26, '%3Cbr%2F%3E'
         28        ECHO                                                     ~27
   19    29        IS_SMALLER_OR_EQUAL                                      !6, !5
         30      > JMPZ                                                     ~28, ->41
   20    31    >   MUL                                              ~29     !0, !7
         32        CONCAT                                           ~30     'Fighter+A+shoots+a+critical+blast+dealing+%3Cb%3E', ~29
         33        CONCAT                                           ~31     ~30, '%3C%2Fb%3E%21'
         34        CONCAT                                           ~32     ~31, '%3Cbr%2F%3E'
         35        ECHO                                                     ~32
   21    36        ECHO                                                     '%3Ci%3E----------------------------%3C%2Fi%3E%3Cbr%2F%3E'
   22    37        MUL                                              ~33     !0, !7
         38        ADD                                              ~34     ~33, !2
         39        ASSIGN                                                   !2, ~34
         40      > JMP                                                      ->62
   23    41    >   IS_SMALLER_OR_EQUAL                                      !0, !4
         42      > JMPZ                                                     ~36, ->54
   25    43    >   CONCAT                                           ~37     'Fighter+A+shoots+a+glancing+blow+of+', !0
         44        CONCAT                                           ~38     ~37, '+against+the+target%27s+'
         45        CONCAT                                           ~39     ~38, !4
         46        CONCAT                                           ~40     ~39, '+armor%2C+dealing+%3Cb%3E0%3C%2Fb%3E%21'
         47        CONCAT                                           ~41     ~40, '%3Cbr%2F%3E'
         48        ECHO                                                     ~41
   26    49        ASSIGN                                                   !0, 0
   27    50        ECHO                                                     '%3Ci%3E----------------------------%3C%2Fi%3E%3Cbr%2F%3E'
   28    51        ADD                                              ~43     !0, !2
         52        ASSIGN                                                   !2, ~43
         53      > JMP                                                      ->62
   30    54    >   ASSIGN                                                   !0, !0
   31    55        CONCAT                                           ~46     'Fighter+A+shoots+for+%3Cb%3E', !0
         56        CONCAT                                           ~47     ~46, '%3C%2Fb%3E%21'
         57        CONCAT                                           ~48     ~47, '%3Cbr%2F%3E'
         58        ECHO                                                     ~48
   32    59        ECHO                                                     '%3Ci%3E----------------------------%3C%2Fi%3E%3Cbr%2F%3E'
   33    60        ADD                                              ~49     !0, !2
         61        ASSIGN                                                   !2, ~49
   38    62    >   IS_NOT_EQUAL                                             !0, 10
         63      > JMPNZ                                                    ~51, ->8
   39    64    >   ECHO                                                     'The+round+is+over.+'
   40    65        CONCAT                                           ~52     'We+rolled+', !1
         66        CONCAT                                           ~53     ~52, '+times+and+obtained+a+10%21'
         67        CONCAT                                           ~54     ~53, '%3Cbr%2F%3E'
         68        ECHO                                                     ~54
   41    69        CONCAT                                           ~55     'Total+damage+dealt%3A+%3Cb%3E', !2
         70        CONCAT                                           ~56     ~55, '%3C%2Fb%3E'
         71        ECHO                                                     ~56
   43    72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.32 ms | 1392 KiB | 15 Q