3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Conv( $a, $s ) { switch ( $s ) { case 'k': { $s = 1; $t = 'KB'; } break; case 'm': { $s = 2; $t = 'MB'; } break; case 'g': { $s = 3; $t = 'GB'; } break; case 't': { $s = 4; $t = 'TB'; } break; default: { $s = 0; $t = 'B'; } break; } return [ $a * pow( 1024, $s ), $t ]; // gives "A non well formed numeric value encountered" } var_dump( Conv("3", "k") ); var_dump( Conv("3k", "k") );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iPMOV
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'conv'
          2        SEND_VAL                                                 '3'
          3        SEND_VAL                                                 'k'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   16     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'conv'
          9        SEND_VAL                                                 '3k'
         10        SEND_VAL                                                 'k'
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function conv:
Finding entry points
Branch analysis from position: 0
6 jumps found. (Code = 188) Position 1 = 12, Position 2 = 15, Position 3 = 18, Position 4 = 21, Position 5 = 24, Position 6 = 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 21
Branch analysis from position: 18
Branch analysis from position: 15
Branch analysis from position: 12
filename:       /in/iPMOV
function name:  Conv
number of ops:  36
compiled vars:  !0 = $a, !1 = $s, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2      > SWITCH_STRING                                            !1, [ 'k':->12, 'm':->15, 'g':->18, 't':->21, ], ->24
    5     3    >   IS_EQUAL                                                 !1, 'k'
          4      > JMPNZ                                                    ~3, ->12
    6     5    >   IS_EQUAL                                                 !1, 'm'
          6      > JMPNZ                                                    ~3, ->15
    7     7    >   IS_EQUAL                                                 !1, 'g'
          8      > JMPNZ                                                    ~3, ->18
    8     9    >   IS_EQUAL                                                 !1, 't'
         10      > JMPNZ                                                    ~3, ->21
         11    > > JMP                                                      ->24
    5    12    >   ASSIGN                                                   !1, 1
         13        ASSIGN                                                   !2, 'KB'
         14      > JMP                                                      ->27
    6    15    >   ASSIGN                                                   !1, 2
         16        ASSIGN                                                   !2, 'MB'
         17      > JMP                                                      ->27
    7    18    >   ASSIGN                                                   !1, 3
         19        ASSIGN                                                   !2, 'GB'
         20      > JMP                                                      ->27
    8    21    >   ASSIGN                                                   !1, 4
         22        ASSIGN                                                   !2, 'TB'
         23      > JMP                                                      ->27
    9    24    >   ASSIGN                                                   !1, 0
         25        ASSIGN                                                   !2, 'B'
         26      > JMP                                                      ->27
   11    27    >   INIT_FCALL                                               'pow'
         28        SEND_VAL                                                 1024
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $14     
         31        MUL                                              ~15     !0, $14
         32        INIT_ARRAY                                       ~16     ~15
         33        ADD_ARRAY_ELEMENT                                ~16     !2
         34      > RETURN                                                   ~16
   12    35*     > RETURN                                                   null

End of function conv

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.66 ms | 1403 KiB | 19 Q