3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_number($n) { $str = number_format($number, 4, '.', ''); $str = preg_replace('/(?<\.\d{2})0+$/', '', $str); } var_dump(format_number(4.0)); var_dump(format_number(4.5)); var_dump(format_number(4.454)); var_dump(format_number(4.54545454)); var_dump(format_number(4.450));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GuU37
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'format_number'
          2        SEND_VAL                                                 4
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    9     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'format_number'
          8        SEND_VAL                                                 4.5
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   10    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'format_number'
         14        SEND_VAL                                                 4.454
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   11    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'format_number'
         20        SEND_VAL                                                 4.54545
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
   12    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'format_number'
         26        SEND_VAL                                                 4.45
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function format_number:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GuU37
function name:  format_number
number of ops:  15
compiled vars:  !0 = $n, !1 = $str, !2 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'number_format'
          2        SEND_VAR                                                 !2
          3        SEND_VAL                                                 4
          4        SEND_VAL                                                 '.'
          5        SEND_VAL                                                 ''
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !1, $3
    5     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%2F%28%3F%3C%5C.%5Cd%7B2%7D%290%2B%24%2F'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !1, $5
    6    14      > RETURN                                                   null

End of function format_number

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.49 ms | 1403 KiB | 24 Q