3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getValueInBytes($input) { // see: http://www.php.net/manual/en/function.ini-get.php $input = trim($input); $last = strtolower($input[strlen($input) - 1]); $numericInput = (float) substr($input, 0, -1); switch ($last) { case 'g': $numericInput *= 1024; case 'm': $numericInput *= 1024; case 'k': $numericInput *= 1024; return $numericInput; } return $input; } echo getValueInBytes(-1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VsvZ1
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'getvalueinbytes'
          1        SEND_VAL                                                 -1
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

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

End of function getvalueinbytes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.78 ms | 1403 KiB | 20 Q