3v4l.org

run code in 300+ 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:  34
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                                               'sprintf'
         18        SEND_VAL                                                 '%25s+%25s'
         19        INIT_FCALL                                               'round'
         20        INIT_FCALL                                               'pow'
         21        SEND_VAL                                                 1024
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $11     
         24        DIV                                              ~12     !0, $11
         25        SEND_VAL                                                 ~12
         26        SEND_VAL                                                 2
         27        DO_ICALL                                         $13     
         28        SEND_VAR                                                 $13
         29        FETCH_DIM_R                                      ~14     !1, !2
         30        SEND_VAL                                                 ~14
         31        DO_ICALL                                         $15     
         32      > RETURN                                                   $15
    9    33*     > RETURN                                                   null

End of function fm_get_filesize

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.87 ms | 1403 KiB | 26 Q