3v4l.org

run code in 300+ PHP versions simultaneously
<?php function prettynum($num, $dollar = null) { global $mtgdb; $out = strrev((string) preg_replace('/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($num))); if($dollar && is_numeric($num)) { $out = "$" . $out; } return $out; } echo prettynum(123456),"<br />"; echo prettynum(123456, 1),"<br />"; echo number_format(123456);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AlCra
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'prettynum'
          1        SEND_VAL                                                 123456
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%3Cbr+%2F%3E'
   12     5        INIT_FCALL                                               'prettynum'
          6        SEND_VAL                                                 123456
          7        SEND_VAL                                                 1
          8        DO_FCALL                                      0  $1      
          9        ECHO                                                     $1
         10        ECHO                                                     '%3Cbr+%2F%3E'
   13    11        INIT_FCALL                                               'number_format'
         12        SEND_VAL                                                 123456
         13        DO_ICALL                                         $2      
         14        ECHO                                                     $2
         15      > RETURN                                                   1

Function prettynum:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 21
filename:       /in/AlCra
function name:  prettynum
number of ops:  26
compiled vars:  !0 = $num, !1 = $dollar, !2 = $mtgdb, !3 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    3     2        BIND_GLOBAL                                              !2, 'mtgdb'
    4     3        INIT_FCALL                                               'strrev'
          4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%2F%28%5Cd%7B3%7D%29%28%3F%3D%5Cd%29%28%3F%21%5Cd%2A%5C.%29%2F'
          6        SEND_VAL                                                 '%241%2C'
          7        INIT_FCALL                                               'strrev'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                         $5      
         12        CAST                                          6  ~6      $5
         13        SEND_VAL                                                 ~6
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !3, $7
    5    16      > JMPZ_EX                                          ~9      !1, ->21
         17    >   INIT_FCALL                                               'is_numeric'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $10     
         20        BOOL                                             ~9      $10
         21    > > JMPZ                                                     ~9, ->24
    6    22    >   CONCAT                                           ~11     '%24', !3
         23        ASSIGN                                                   !3, ~11
    8    24    > > RETURN                                                   !3
    9    25*     > RETURN                                                   null

End of function prettynum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.28 ms | 1407 KiB | 23 Q