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; $power = ($power > (count($units) - 1)) ? (count($units) - 1) : $power; 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/HVirr
function name:  (null)
number of ops:  20
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->17
   13     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
   12    16        PRE_INC                                                      !0
         17    >   IS_SMALLER                                                   !0, 100
         18      > JMPNZ                                                        ~8, ->2
   14    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
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
Branch analysis from position: 25
filename:       /in/HVirr
function name:  fm_get_filesize
number of ops:  42
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        COUNT                                                ~11     !1
         18        SUB                                                  ~12     ~11, 1
         19        IS_SMALLER                                                   ~12, !2
         20      > JMPZ                                                         ~13, ->25
         21    >   COUNT                                                ~14     !1
         22        SUB                                                  ~15     ~14, 1
         23        QM_ASSIGN                                            ~16     ~15
         24      > JMP                                                          ->26
         25    >   QM_ASSIGN                                            ~16     !2
         26    >   ASSIGN                                                       !2, ~16
    9    27        INIT_FCALL                                                   'round'
         28        INIT_FCALL                                                   'pow'
         29        SEND_VAL                                                     1024
         30        SEND_VAR                                                     !2
         31        DO_ICALL                                             $18     
         32        DIV                                                  ~19     !0, $18
         33        SEND_VAL                                                     ~19
         34        SEND_VAL                                                     2
         35        DO_ICALL                                             $20     
         36        FETCH_DIM_R                                          ~21     !1, !2
         37        ROPE_INIT                                         3  ~23     $20
         38        ROPE_ADD                                          1  ~23     ~23, '+'
         39        ROPE_END                                          2  ~22     ~23, ~21
         40      > RETURN                                                       ~22
   10    41*     > RETURN                                                       null

End of function fm_get_filesize

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
196.74 ms | 4169 KiB | 21 Q