3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('nice_number')) { function nice_number($n) { // first strip any formatting; $n = (0 + str_replace(",", "", $n)); // is this a number? if (!is_numeric($n)) return false; // now filter it; if ($n > 1000000000000) return round(($n / 1000000000000), 2) . ' tn'; else if ($n > 1000000000) return round(($n / 1000000000), 2) . ' bn'; else if ($n > 1000000) return round(($n / 1000000), 2) . ' mn'; else if ($n > 1000) return round(($n / 1000), 2) . ' K'; return number_format($n); } } echo nice_number(300200000);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/eZDBV
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'nice_number'
          2        DO_ICALL                                         $0      
          3        BOOL_NOT                                         ~1      $0
          4      > JMPZ                                                     ~1, ->6
    5     5    >   DECLARE_FUNCTION                                         'nice_number'
   26     6    >   INIT_FCALL_BY_NAME                                       'nice_number'
          7        SEND_VAL_EX                                              300200000
          8        DO_FCALL                                      0  $2      
          9        ECHO                                                     $2
         10      > RETURN                                                   1

Function %00nice_number%2Fin%2FeZDBV%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 44
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 53
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eZDBV
function name:  nice_number
number of ops:  58
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%2C'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6        ADD                                              ~2      0, $1
          7        ASSIGN                                                   !0, ~2
    9     8        INIT_FCALL                                               'is_numeric'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11        BOOL_NOT                                         ~5      $4
         12      > JMPZ                                                     ~5, ->14
   10    13    > > RETURN                                                   <false>
   12    14    >   IS_SMALLER                                               1000000000000, !0
         15      > JMPZ                                                     ~6, ->24
   13    16    >   INIT_FCALL                                               'round'
         17        DIV                                              ~7      !0, 1000000000000
         18        SEND_VAL                                                 ~7
         19        SEND_VAL                                                 2
         20        DO_ICALL                                         $8      
         21        CONCAT                                           ~9      $8, '+tn'
         22      > RETURN                                                   ~9
         23*       JMP                                                      ->53
   14    24    >   IS_SMALLER                                               1000000000, !0
         25      > JMPZ                                                     ~10, ->34
   15    26    >   INIT_FCALL                                               'round'
         27        DIV                                              ~11     !0, 1000000000
         28        SEND_VAL                                                 ~11
         29        SEND_VAL                                                 2
         30        DO_ICALL                                         $12     
         31        CONCAT                                           ~13     $12, '+bn'
         32      > RETURN                                                   ~13
         33*       JMP                                                      ->53
   16    34    >   IS_SMALLER                                               1000000, !0
         35      > JMPZ                                                     ~14, ->44
   17    36    >   INIT_FCALL                                               'round'
         37        DIV                                              ~15     !0, 1000000
         38        SEND_VAL                                                 ~15
         39        SEND_VAL                                                 2
         40        DO_ICALL                                         $16     
         41        CONCAT                                           ~17     $16, '+mn'
         42      > RETURN                                                   ~17
         43*       JMP                                                      ->53
   18    44    >   IS_SMALLER                                               1000, !0
         45      > JMPZ                                                     ~18, ->53
   19    46    >   INIT_FCALL                                               'round'
         47        DIV                                              ~19     !0, 1000
         48        SEND_VAL                                                 ~19
         49        SEND_VAL                                                 2
         50        DO_ICALL                                         $20     
         51        CONCAT                                           ~21     $20, '+K'
         52      > RETURN                                                   ~21
   21    53    >   INIT_FCALL                                               'number_format'
         54        SEND_VAR                                                 !0
         55        DO_ICALL                                         $22     
         56      > RETURN                                                   $22
   22    57*     > RETURN                                                   null

End of function %00nice_number%2Fin%2FeZDBV%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.57 ms | 1400 KiB | 23 Q