3v4l.org

run code in 500+ PHP versions simultaneously
<?php function getDestroyChance($death_stars_number, $diameter) { $death_stars_vars = array(0, 0, 0, 10, 10); $diameter_vars = array(-20, -80, 100, 0, 15); $diameter_exp_const = 18000; $offset = 30; $death_stars_factor = 0.0; for ($i = 0; $i < sizeof($death_stars_vars); $i++){ $death_stars_factor += $death_stars_vars[$i] * pow(log10($death_stars_number), $i); } $diameter_factor = 0.0; for ($i = 0; $i < sizeof($diameter_vars); $i++) { $diameter_factor += $diameter_vars[$i] * pow(exp($diameter / $diameter_exp_const), $i); } $chance = 100 - $death_stars_factor / $diameter_factor + $offset; $chance = min($chance, 100); $chance = max($chance, 10); return round($chance); } $res = getDestroyChance(3000000, 2500); var_dump($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tHchM
function name:  (null)
number of ops:  9
compiled vars:  !0 = $res
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                                   'getdestroychance'
          1        SEND_VAL                                                     3000000
          2        SEND_VAL                                                     2500
          3        DO_FCALL                                          0  $1      
          4        ASSIGN                                                       !0, $1
   28     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Function getdestroychance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 9
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 26
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 26
Branch analysis from position: 41
Branch analysis from position: 26
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 9
Branch analysis from position: 23
Branch analysis from position: 9
filename:       /in/tHchM
function name:  getDestroyChance
number of ops:  54
compiled vars:  !0 = $death_stars_number, !1 = $diameter, !2 = $death_stars_vars, !3 = $diameter_vars, !4 = $diameter_exp_const, !5 = $offset, !6 = $death_stars_factor, !7 = $i, !8 = $diameter_factor, !9 = $chance
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        ASSIGN                                                       !2, <array>
    5     3        ASSIGN                                                       !3, <array>
    6     4        ASSIGN                                                       !4, 18000
    7     5        ASSIGN                                                       !5, 30
    8     6        ASSIGN                                                       !6, 0
    9     7        ASSIGN                                                       !7, 0
          8      > JMP                                                          ->20
   10     9    >   FETCH_DIM_R                                          ~16     !2, !7
         10        INIT_FCALL                                                   'pow'
         11        INIT_FCALL                                                   'log10'
         12        SEND_VAR                                                     !0
         13        DO_ICALL                                             $17     
         14        SEND_VAR                                                     $17
         15        SEND_VAR                                                     !7
         16        DO_ICALL                                             $18     
         17        MUL                                                  ~19     $18, ~16
         18        ASSIGN_OP                                         1          !6, ~19
    9    19        PRE_INC                                                      !7
         20    >   COUNT                                                ~22     !2
         21        IS_SMALLER                                                   !7, ~22
         22      > JMPNZ                                                        ~23, ->9
   14    23    >   ASSIGN                                                       !8, 0
   15    24        ASSIGN                                                       !7, 0
         25      > JMP                                                          ->38
   16    26    >   FETCH_DIM_R                                          ~26     !3, !7
         27        INIT_FCALL                                                   'pow'
         28        INIT_FCALL                                                   'exp'
         29        DIV                                                  ~27     !1, !4
         30        SEND_VAL                                                     ~27
         31        DO_ICALL                                             $28     
         32        SEND_VAR                                                     $28
         33        SEND_VAR                                                     !7
         34        DO_ICALL                                             $29     
         35        MUL                                                  ~30     $29, ~26
         36        ASSIGN_OP                                         1          !8, ~30
   15    37        PRE_INC                                                      !7
         38    >   COUNT                                                ~33     !3
         39        IS_SMALLER                                                   !7, ~33
         40      > JMPNZ                                                        ~34, ->26
   19    41    >   DIV                                                  ~35     !6, !8
         42        SUB                                                  ~36     100, ~35
         43        ADD                                                  ~37     ~36, !5
         44        ASSIGN                                                       !9, ~37
   20    45        FRAMELESS_ICALL_2                min                 ~39     !9, 100
         46        ASSIGN                                                       !9, ~39
   21    47        FRAMELESS_ICALL_2                max                 ~41     !9, 10
         48        ASSIGN                                                       !9, ~41
   22    49        INIT_FCALL                                                   'round'
         50        SEND_VAR                                                     !9
         51        DO_ICALL                                             $43     
         52      > RETURN                                                       $43
   23    53*     > RETURN                                                       null

End of function getdestroychance

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.4 ms | 2039 KiB | 19 Q