3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($bytes) { return floor(($bytes ? log($bytes) : 0) / log(1024)); } var_dump(f(200000)); var_dump(f(15000)); var_dump(f(2000000));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s03X3
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'f'
          2        SEND_VAL                                                 200000
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    7     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'f'
          8        SEND_VAL                                                 15000
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
    8    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'f'
         14        SEND_VAL                                                 2000000
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s03X3
function name:  f
number of ops:  17
compiled vars:  !0 = $bytes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'floor'
          2      > JMPZ                                                     !0, ->8
          3    >   INIT_FCALL                                               'log'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6        QM_ASSIGN                                        ~2      $1
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~2      0
          9    >   INIT_FCALL                                               'log'
         10        SEND_VAL                                                 1024
         11        DO_ICALL                                         $3      
         12        DIV                                              ~4      ~2, $3
         13        SEND_VAL                                                 ~4
         14        DO_ICALL                                         $5      
         15      > RETURN                                                   $5
    4    16*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.96 ms | 1399 KiB | 22 Q