3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_num($num, $precision = 2) { if ($num >= 1000) { $n_format = number_format($num/1000,$precision).'K'; } else { $n_format = $num; } return $n_format; } echo format_num(1200,1); echo format_num(1230000); echo format_num(1234000000,3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g61s4
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'format_num'
          1        SEND_VAL                                                 1200
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   13     5        INIT_FCALL                                               'format_num'
          6        SEND_VAL                                                 1230000
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
   14     9        INIT_FCALL                                               'format_num'
         10        SEND_VAL                                                 1234000000
         11        SEND_VAL                                                 3
         12        DO_FCALL                                      0  $2      
         13        ECHO                                                     $2
         14      > RETURN                                                   1

Function format_num:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g61s4
function name:  format_num
number of ops:  15
compiled vars:  !0 = $num, !1 = $precision, !2 = $n_format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      2
    4     2        IS_SMALLER_OR_EQUAL                                      1000, !0
          3      > JMPZ                                                     ~3, ->12
    5     4    >   INIT_FCALL                                               'number_format'
          5        DIV                                              ~4      !0, 1000
          6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      $5, 'K'
         10        ASSIGN                                                   !2, ~6
         11      > JMP                                                      ->13
    7    12    >   ASSIGN                                                   !2, !0
    9    13    > > RETURN                                                   !2
   10    14*     > RETURN                                                   null

End of function format_num

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.48 ms | 1399 KiB | 18 Q