3v4l.org

run code in 500+ PHP versions simultaneously
<?php function fm_get_filesize($size) { $size = (float) $size; $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); $power = $size > 0 ? floor(log($size, 1024)) : 0; return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]); } for ($i = 0; $i < 100; $i++) { echo fm_get_filesize(pow('102'.rand(4, 100), $i))."\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 2
Branch analysis from position: 19
Branch analysis from position: 2
filename:       /in/1qHit
function name:  (null)
number of ops:  20
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->17
   12     2    >   INIT_FCALL                                                   'fm_get_filesize'
          3        INIT_FCALL                                                   'pow'
          4        INIT_FCALL                                                   'rand'
          5        SEND_VAL                                                     4
          6        SEND_VAL                                                     100
          7        DO_ICALL                                             $2      
          8        CONCAT                                               ~3      '102', $2
          9        SEND_VAL                                                     ~3
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                             $4      
         12        SEND_VAR                                                     $4
         13        DO_FCALL                                          0  $5      
         14        CONCAT                                               ~6      $5, '%0A'
         15        ECHO                                                         ~6
   11    16        PRE_INC                                                      !0
         17    >   IS_SMALLER                                                   !0, 100
         18      > JMPNZ                                                        ~8, ->2
   13    19    > > RETURN                                                       1

Function fm_get_filesize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1qHit
function name:  fm_get_filesize
number of ops:  32
compiled vars:  !0 = $size, !1 = $units, !2 = $power
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1        CAST                                              5  ~3      !0
          2        ASSIGN                                                       !0, ~3
    6     3        ASSIGN                                                       !1, <array>
    7     4        IS_SMALLER                                                   0, !0
          5      > JMPZ                                                         ~6, ->15
          6    >   INIT_FCALL                                                   'floor'
          7        INIT_FCALL                                                   'log'
          8        SEND_VAR                                                     !0
          9        SEND_VAL                                                     1024
         10        DO_ICALL                                             $7      
         11        SEND_VAR                                                     $7
         12        DO_ICALL                                             $8      
         13        QM_ASSIGN                                            ~9      $8
         14      > JMP                                                          ->16
         15    >   QM_ASSIGN                                            ~9      0
         16    >   ASSIGN                                                       !2, ~9
    8    17        INIT_FCALL                                                   'round'
         18        INIT_FCALL                                                   'pow'
         19        SEND_VAL                                                     1024
         20        SEND_VAR                                                     !2
         21        DO_ICALL                                             $11     
         22        DIV                                                  ~12     !0, $11
         23        SEND_VAL                                                     ~12
         24        SEND_VAL                                                     2
         25        DO_ICALL                                             $13     
         26        FETCH_DIM_R                                          ~14     !1, !2
         27        ROPE_INIT                                         3  ~16     $13
         28        ROPE_ADD                                          1  ~16     ~16, '+'
         29        ROPE_END                                          2  ~15     ~16, ~14
         30      > RETURN                                                       ~15
    9    31*     > RETURN                                                       null

End of function fm_get_filesize

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.43 ms | 1850 KiB | 20 Q