3v4l.org

run code in 300+ PHP versions simultaneously
<?php $separator = 'comma'; $number = '1,233,332.34'; $thousand_separator = ','; if ($separator != 'comma') { $thousand_separator = '.'; } $number = str_replace($thousand_separator, '', $number); echo number_format($number, 2, ',','.');
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/4AZI2
function name:  (null)
number of ops:  20
compiled vars:  !0 = $separator, !1 = $number, !2 = $thousand_separator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'comma'
    3     1        ASSIGN                                                   !1, '1%2C233%2C332.34'
    4     2        ASSIGN                                                   !2, '%2C'
    6     3        IS_NOT_EQUAL                                             !0, 'comma'
          4      > JMPZ                                                     ~6, ->6
    7     5    >   ASSIGN                                                   !2, '.'
   10     6    >   INIT_FCALL                                               'str_replace'
          7        SEND_VAR                                                 !2
          8        SEND_VAL                                                 ''
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !1, $8
   11    12        INIT_FCALL                                               'number_format'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 2
         15        SEND_VAL                                                 '%2C'
         16        SEND_VAL                                                 '.'
         17        DO_ICALL                                         $10     
         18        ECHO                                                     $10
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.44 ms | 1395 KiB | 17 Q