3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.69 ms | 1400 KiB | 19 Q