3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pc = 0; $gigs = 150; $str = '1001M'; if (strstr($str[0], 'G')) { $type = "G"; $pc = str_replace('G','',$str[0]) / $gigs * 100; $pc = round($pc,2); } elseif (strstr($str[0], 'M')) { $type = "G"; $pc = str_replace('M','',$str[0]) / $gigs; $pc = round($pc,2); } if ($pc >= 100 && $type == "G") { $pc = 100; } echo $pc;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 25
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 49
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 45
Branch analysis from position: 31
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
Branch analysis from position: 49
Branch analysis from position: 45
filename:       /in/5U2Ua
function name:  (null)
number of ops:  53
compiled vars:  !0 = $pc, !1 = $gigs, !2 = $str, !3 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
    4     1        ASSIGN                                                   !1, 150
    5     2        ASSIGN                                                   !2, '1001M'
    7     3        INIT_FCALL                                               'strstr'
          4        FETCH_DIM_R                                      ~7      !2, 0
          5        SEND_VAL                                                 ~7
          6        SEND_VAL                                                 'G'
          7        DO_ICALL                                         $8      
          8      > JMPZ                                                     $8, ->25
    9     9    >   ASSIGN                                                   !3, 'G'
   10    10        INIT_FCALL                                               'str_replace'
         11        SEND_VAL                                                 'G'
         12        SEND_VAL                                                 ''
         13        FETCH_DIM_R                                      ~10     !2, 0
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                         $11     
         16        DIV                                              ~12     $11, !1
         17        MUL                                              ~13     ~12, 100
         18        ASSIGN                                                   !0, ~13
   11    19        INIT_FCALL                                               'round'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $15     
         23        ASSIGN                                                   !0, $15
         24      > JMP                                                      ->45
   13    25    >   INIT_FCALL                                               'strstr'
         26        FETCH_DIM_R                                      ~17     !2, 0
         27        SEND_VAL                                                 ~17
         28        SEND_VAL                                                 'M'
         29        DO_ICALL                                         $18     
         30      > JMPZ                                                     $18, ->45
   15    31    >   ASSIGN                                                   !3, 'G'
   16    32        INIT_FCALL                                               'str_replace'
         33        SEND_VAL                                                 'M'
         34        SEND_VAL                                                 ''
         35        FETCH_DIM_R                                      ~20     !2, 0
         36        SEND_VAL                                                 ~20
         37        DO_ICALL                                         $21     
         38        DIV                                              ~22     $21, !1
         39        ASSIGN                                                   !0, ~22
   17    40        INIT_FCALL                                               'round'
         41        SEND_VAR                                                 !0
         42        SEND_VAL                                                 2
         43        DO_ICALL                                         $24     
         44        ASSIGN                                                   !0, $24
   20    45    >   IS_SMALLER_OR_EQUAL                              ~26     100, !0
         46      > JMPZ_EX                                          ~26     ~26, ->49
         47    >   IS_EQUAL                                         ~27     !3, 'G'
         48        BOOL                                             ~26     ~27
         49    > > JMPZ                                                     ~26, ->51
         50    >   ASSIGN                                                   !0, 100
   22    51    >   ECHO                                                     !0
         52      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.38 ms | 1400 KiB | 19 Q