3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convert(int $number) { if ($number >= 1E9) { return round($number / 1E9, 2).'b'; } else if ($number >= 1E6) { return round($number / 1E6, 2).'m'; } else if ($number >= 1E3) { return round($number / 1E3, 2).'k'; } return $number; } echo convert(1000000001).PHP_EOL; echo convert(1000000).PHP_EOL; echo convert(1200).PHP_EOL; echo convert(1234).PHP_EOL; echo convert(100).PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cc54H
function name:  (null)
number of ops:  26
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'convert'
          1        SEND_VAL                                                 1000000001
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   15     5        INIT_FCALL                                               'convert'
          6        SEND_VAL                                                 1000000
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   16    10        INIT_FCALL                                               'convert'
         11        SEND_VAL                                                 1200
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
   17    15        INIT_FCALL                                               'convert'
         16        SEND_VAL                                                 1234
         17        DO_FCALL                                      0  $6      
         18        CONCAT                                           ~7      $6, '%0A'
         19        ECHO                                                     ~7
   18    20        INIT_FCALL                                               'convert'
         21        SEND_VAL                                                 100
         22        DO_FCALL                                      0  $8      
         23        CONCAT                                           ~9      $8, '%0A'
         24        ECHO                                                     ~9
   19    25      > RETURN                                                   1

Function convert:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 30
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cc54H
function name:  convert
number of ops:  32
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        IS_SMALLER_OR_EQUAL                                      1.0e+9, !0
          2      > JMPZ                                                     ~1, ->11
    5     3    >   INIT_FCALL                                               'round'
          4        DIV                                              ~2      !0, 1.0e+9
          5        SEND_VAL                                                 ~2
          6        SEND_VAL                                                 2
          7        DO_ICALL                                         $3      
          8        CONCAT                                           ~4      $3, 'b'
          9      > RETURN                                                   ~4
    4    10*       JMP                                                      ->30
    6    11    >   IS_SMALLER_OR_EQUAL                                      1.0e+6, !0
         12      > JMPZ                                                     ~5, ->21
    7    13    >   INIT_FCALL                                               'round'
         14        DIV                                              ~6      !0, 1.0e+6
         15        SEND_VAL                                                 ~6
         16        SEND_VAL                                                 2
         17        DO_ICALL                                         $7      
         18        CONCAT                                           ~8      $7, 'm'
         19      > RETURN                                                   ~8
    6    20*       JMP                                                      ->30
    8    21    >   IS_SMALLER_OR_EQUAL                                      1000, !0
         22      > JMPZ                                                     ~9, ->30
    9    23    >   INIT_FCALL                                               'round'
         24        DIV                                              ~10     !0, 1000
         25        SEND_VAL                                                 ~10
         26        SEND_VAL                                                 2
         27        DO_ICALL                                         $11     
         28        CONCAT                                           ~12     $11, 'k'
         29      > RETURN                                                   ~12
   11    30    > > RETURN                                                   !0
   12    31*     > RETURN                                                   null

End of function convert

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.73 ms | 1009 KiB | 19 Q