3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_config_bytes($val) { $val = trim($val); $last = substr($val, -1); // Get the last character $val = rtrim($val, $last); // Trim away the last character which isn't a number switch(strtolower($last)) { case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k': $val *= 1024; } return $val; } var_dump(get_config_bytes('20M'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4bbpJ
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'get_config_bytes'
          2        SEND_VAL                                                 '20M'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function get_config_bytes:
Finding entry points
Branch analysis from position: 0
5 jumps found. (Code = 188) Position 1 = 26, Position 2 = 27, Position 3 = 28, Position 4 = 29, Position 5 = 19
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 28
Branch analysis from position: 29
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 28
Branch analysis from position: 27
Branch analysis from position: 26
filename:       /in/4bbpJ
function name:  get_config_bytes
number of ops:  32
compiled vars:  !0 = $val, !1 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
    5     5        INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 -1
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !1, $4
    6    10        INIT_FCALL                                               'rtrim'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $6      
         14        ASSIGN                                                   !0, $6
    8    15        INIT_FCALL                                               'strtolower'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $8      
         18      > SWITCH_STRING                                            $8, [ 'g':->26, 'm':->27, 'k':->28, ], ->29
    9    19    >   CASE                                                     $8, 'g'
         20      > JMPNZ                                                    ~9, ->26
   11    21    >   CASE                                                     $8, 'm'
         22      > JMPNZ                                                    ~9, ->27
   13    23    >   CASE                                                     $8, 'k'
         24      > JMPNZ                                                    ~9, ->28
         25    > > JMP                                                      ->29
   10    26    >   ASSIGN_OP                                     3          !0, 1024
   12    27    >   ASSIGN_OP                                     3          !0, 1024
   14    28    >   ASSIGN_OP                                     3          !0, 1024
         29    >   FREE                                                     $8
   16    30      > RETURN                                                   !0
   17    31*     > RETURN                                                   null

End of function get_config_bytes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.98 ms | 1011 KiB | 19 Q