3v4l.org

run code in 300+ PHP versions simultaneously
<?php function infVal($n, $prec = 3) { $size = preg_replace('/[^0-9]/', '', $n); $sizes = array("", "K", "M"); if ($size == 0) { return('n/a'); } return floor($size/pow(1000, ($i = floor(log($size, 1000))))) . $sizes[$i]; } var_dump( infVal(999), infVal(999999), infVal(1000000) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RflXI
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
   16     1        INIT_FCALL                                               'infval'
          2        SEND_VAL                                                 999
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
   17     5        INIT_FCALL                                               'infval'
          6        SEND_VAL                                                 999999
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
   18     9        INIT_FCALL                                               'infval'
         10        SEND_VAL                                                 1000000
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
   19    14      > RETURN                                                   1

Function infval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RflXI
function name:  infVal
number of ops:  32
compiled vars:  !0 = $n, !1 = $prec, !2 = $size, !3 = $sizes, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      3
    5     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5B%5E0-9%5D%2F'
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
    6     8        ASSIGN                                                   !3, <array>
    8     9        IS_EQUAL                                                 !2, 0
         10      > JMPZ                                                     ~8, ->12
    9    11    > > RETURN                                                   'n%2Fa'
   12    12    >   INIT_FCALL                                               'floor'
         13        INIT_FCALL                                               'pow'
         14        SEND_VAL                                                 1000
         15        INIT_FCALL                                               'floor'
         16        INIT_FCALL                                               'log'
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 1000
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                         $10     
         22        ASSIGN                                           ~11     !4, $10
         23        SEND_VAL                                                 ~11
         24        DO_ICALL                                         $12     
         25        DIV                                              ~13     !2, $12
         26        SEND_VAL                                                 ~13
         27        DO_ICALL                                         $14     
         28        FETCH_DIM_R                                      ~15     !3, !4
         29        CONCAT                                           ~16     $14, ~15
         30      > RETURN                                                   ~16
   13    31*     > RETURN                                                   null

End of function infval

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.59 ms | 1407 KiB | 26 Q