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; $str = ''; if ($n > 1000000000000) { $str = round(($n / 1000000000000), 0) . ' tn '; $str .= nice_number($n % 1000000000000); return $str; } else if ($n > 1000000000) { $str = round(($n / 1000000000), 0) . ' bn '; $str .= nice_number($n % 1000000000); return $str; } else if ($n > 1000000) { $str = round(($n / 1000000), 0) . ' mn '; $str .= nice_number($n % 1000000); return $str; } 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/0FCrb
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'
   36     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%2F0FCrb%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 = 17, Position 2 = 31
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 47
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 63
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 72
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0FCrb
function name:  nice_number
number of ops:  77
compiled vars:  !0 = $n, !1 = $str
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                                         $2      
          6        ADD                                              ~3      0, $2
          7        ASSIGN                                                   !0, ~3
    9     8        INIT_FCALL                                               'is_numeric'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $5      
         11        BOOL_NOT                                         ~6      $5
         12      > JMPZ                                                     ~6, ->14
   10    13    > > RETURN                                                   <false>
   12    14    >   ASSIGN                                                   !1, ''
   13    15        IS_SMALLER                                               1000000000000, !0
         16      > JMPZ                                                     ~8, ->31
   14    17    >   INIT_FCALL                                               'round'
         18        DIV                                              ~9      !0, 1000000000000
         19        SEND_VAL                                                 ~9
         20        SEND_VAL                                                 0
         21        DO_ICALL                                         $10     
         22        CONCAT                                           ~11     $10, '+tn+'
         23        ASSIGN                                                   !1, ~11
   15    24        INIT_FCALL_BY_NAME                                       'nice_number'
         25        MOD                                              ~13     !0, 1000000000000
         26        SEND_VAL_EX                                              ~13
         27        DO_FCALL                                      0  $14     
         28        ASSIGN_OP                                     8          !1, $14
   16    29      > RETURN                                                   !1
         30*       JMP                                                      ->72
   18    31    >   IS_SMALLER                                               1000000000, !0
         32      > JMPZ                                                     ~16, ->47
   19    33    >   INIT_FCALL                                               'round'
         34        DIV                                              ~17     !0, 1000000000
         35        SEND_VAL                                                 ~17
         36        SEND_VAL                                                 0
         37        DO_ICALL                                         $18     
         38        CONCAT                                           ~19     $18, '+bn+'
         39        ASSIGN                                                   !1, ~19
   20    40        INIT_FCALL_BY_NAME                                       'nice_number'
         41        MOD                                              ~21     !0, 1000000000
         42        SEND_VAL_EX                                              ~21
         43        DO_FCALL                                      0  $22     
         44        ASSIGN_OP                                     8          !1, $22
   21    45      > RETURN                                                   !1
         46*       JMP                                                      ->72
   23    47    >   IS_SMALLER                                               1000000, !0
         48      > JMPZ                                                     ~24, ->63
   24    49    >   INIT_FCALL                                               'round'
         50        DIV                                              ~25     !0, 1000000
         51        SEND_VAL                                                 ~25
         52        SEND_VAL                                                 0
         53        DO_ICALL                                         $26     
         54        CONCAT                                           ~27     $26, '+mn+'
         55        ASSIGN                                                   !1, ~27
   25    56        INIT_FCALL_BY_NAME                                       'nice_number'
         57        MOD                                              ~29     !0, 1000000
         58        SEND_VAL_EX                                              ~29
         59        DO_FCALL                                      0  $30     
         60        ASSIGN_OP                                     8          !1, $30
   26    61      > RETURN                                                   !1
         62*       JMP                                                      ->72
   28    63    >   IS_SMALLER                                               1000, !0
         64      > JMPZ                                                     ~32, ->72
   29    65    >   INIT_FCALL                                               'round'
         66        DIV                                              ~33     !0, 1000
         67        SEND_VAL                                                 ~33
         68        SEND_VAL                                                 2
         69        DO_ICALL                                         $34     
         70        CONCAT                                           ~35     $34, '+K+'
         71      > RETURN                                                   ~35
   31    72    >   INIT_FCALL                                               'number_format'
         73        SEND_VAR                                                 !0
         74        DO_ICALL                                         $36     
         75      > RETURN                                                   $36
   32    76*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.05 ms | 1404 KiB | 23 Q