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 .= $n % 1000000000000 > 0 ? nice_number($n % 1000000000000) : ''; return $str; } else if ($n > 1000000000) { $str = round(($n / 1000000000), 0) . ' bn '; $str .= $n % 1000000000 > 0 ? nice_number($n % 1000000000) : ''; return $str; } else if ($n > 1000000) { $str = round(($n / 1000000), 0) . ' mn '; $str .= $n % 1000000 > 0 ? nice_number($n % 1000000) : ''; return $str; } else if ($n > 1000) return round(($n / 1000), 0) . ' 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/MMacE
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%2FMMacE%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 = 37
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 33
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 59
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 55
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 81
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 77
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 90
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MMacE
function name:  nice_number
number of ops:  95
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, ->37
   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        MOD                                              ~13     !0, 1000000000000
         25        IS_SMALLER                                               0, ~13
         26      > JMPZ                                                     ~14, ->33
         27    >   INIT_FCALL_BY_NAME                                       'nice_number'
         28        MOD                                              ~15     !0, 1000000000000
         29        SEND_VAL_EX                                              ~15
         30        DO_FCALL                                      0  $16     
         31        QM_ASSIGN                                        ~17     $16
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~17     ''
         34    >   ASSIGN_OP                                     8          !1, ~17
   16    35      > RETURN                                                   !1
         36*       JMP                                                      ->90
   18    37    >   IS_SMALLER                                               1000000000, !0
         38      > JMPZ                                                     ~19, ->59
   19    39    >   INIT_FCALL                                               'round'
         40        DIV                                              ~20     !0, 1000000000
         41        SEND_VAL                                                 ~20
         42        SEND_VAL                                                 0
         43        DO_ICALL                                         $21     
         44        CONCAT                                           ~22     $21, '+bn+'
         45        ASSIGN                                                   !1, ~22
   20    46        MOD                                              ~24     !0, 1000000000
         47        IS_SMALLER                                               0, ~24
         48      > JMPZ                                                     ~25, ->55
         49    >   INIT_FCALL_BY_NAME                                       'nice_number'
         50        MOD                                              ~26     !0, 1000000000
         51        SEND_VAL_EX                                              ~26
         52        DO_FCALL                                      0  $27     
         53        QM_ASSIGN                                        ~28     $27
         54      > JMP                                                      ->56
         55    >   QM_ASSIGN                                        ~28     ''
         56    >   ASSIGN_OP                                     8          !1, ~28
   21    57      > RETURN                                                   !1
         58*       JMP                                                      ->90
   23    59    >   IS_SMALLER                                               1000000, !0
         60      > JMPZ                                                     ~30, ->81
   24    61    >   INIT_FCALL                                               'round'
         62        DIV                                              ~31     !0, 1000000
         63        SEND_VAL                                                 ~31
         64        SEND_VAL                                                 0
         65        DO_ICALL                                         $32     
         66        CONCAT                                           ~33     $32, '+mn+'
         67        ASSIGN                                                   !1, ~33
   25    68        MOD                                              ~35     !0, 1000000
         69        IS_SMALLER                                               0, ~35
         70      > JMPZ                                                     ~36, ->77
         71    >   INIT_FCALL_BY_NAME                                       'nice_number'
         72        MOD                                              ~37     !0, 1000000
         73        SEND_VAL_EX                                              ~37
         74        DO_FCALL                                      0  $38     
         75        QM_ASSIGN                                        ~39     $38
         76      > JMP                                                      ->78
         77    >   QM_ASSIGN                                        ~39     ''
         78    >   ASSIGN_OP                                     8          !1, ~39
   26    79      > RETURN                                                   !1
         80*       JMP                                                      ->90
   28    81    >   IS_SMALLER                                               1000, !0
         82      > JMPZ                                                     ~41, ->90
   29    83    >   INIT_FCALL                                               'round'
         84        DIV                                              ~42     !0, 1000
         85        SEND_VAL                                                 ~42
         86        SEND_VAL                                                 0
         87        DO_ICALL                                         $43     
         88        CONCAT                                           ~44     $43, '+K+'
         89      > RETURN                                                   ~44
   31    90    >   INIT_FCALL                                               'number_format'
         91        SEND_VAR                                                 !0
         92        DO_ICALL                                         $45     
         93      > RETURN                                                   $45
   32    94*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.47 ms | 1404 KiB | 23 Q