3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format($number) { $prefixes = 'kMGTPEZY'; if ($number >= 1000) { $log1000 = floor(log10($number)/3); return floor($number/pow(1000, $log1000)).$prefixes[$log1000-1]; } return $number; } echo format(1000);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cqC9v
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'format'
          1        SEND_VAL                                                 1000
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function format:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cqC9v
function name:  format
number of ops:  26
compiled vars:  !0 = $number, !1 = $prefixes, !2 = $log1000
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 'kMGTPEZY'
    5     2        IS_SMALLER_OR_EQUAL                                      1000, !0
          3      > JMPZ                                                     ~4, ->24
    6     4    >   INIT_FCALL                                               'floor'
          5        INIT_FCALL                                               'log10'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        DIV                                              ~6      $5, 3
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
    7    12        INIT_FCALL                                               'floor'
         13        INIT_FCALL                                               'pow'
         14        SEND_VAL                                                 1000
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $9      
         17        DIV                                              ~10     !0, $9
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                         $11     
         20        SUB                                              ~12     !2, 1
         21        FETCH_DIM_R                                      ~13     !1, ~12
         22        CONCAT                                           ~14     $11, ~13
         23      > RETURN                                                   ~14
    9    24    > > RETURN                                                   !0
   10    25*     > RETURN                                                   null

End of function format

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.1 ms | 1399 KiB | 20 Q