3v4l.org

run code in 500+ PHP versions simultaneously
<?php $tests = [ '1,000.00', '1,000.000', '1.000,00', '1.000,000', '1.00', '1.000', '1,00', '1,000', ]; $result = []; foreach ($tests as $test) { $result[] = preg_match('/,\d*$/', $test) ? ['input' => $test, 'thousands' => '.', 'decimal' => ','] : ['input' => $test, 'thousands' => ',', 'decimal' => '.']; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/BrnW7
function name:  (null)
number of ops:  23
compiled vars:  !0 = $tests, !1 = $result, !2 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   13     1        ASSIGN                                                       !1, <array>
   14     2      > FE_RESET_R                                           $5      !0, ->18
          3    > > FE_FETCH_R                                                   $5, !2, ->18
   15     4    >   FRAMELESS_ICALL_2                preg_match          ~7      '%2F%2C%5Cd%2A%24%2F', !2
          5      > JMPZ                                                         ~7, ->11
   16     6    >   INIT_ARRAY                                           ~8      !2, 'input'
          7        ADD_ARRAY_ELEMENT                                    ~8      '.', 'thousands'
          8        ADD_ARRAY_ELEMENT                                    ~8      '%2C', 'decimal'
          9        QM_ASSIGN                                            ~9      ~8
         10      > JMP                                                          ->15
   17    11    >   INIT_ARRAY                                           ~10     !2, 'input'
         12        ADD_ARRAY_ELEMENT                                    ~10     '%2C', 'thousands'
         13        ADD_ARRAY_ELEMENT                                    ~10     '.', 'decimal'
         14        QM_ASSIGN                                            ~9      ~10
   15    15    >   ASSIGN_DIM                                                   !1
   17    16        OP_DATA                                                      ~9
   14    17      > JMP                                                          ->3
         18    >   FE_FREE                                                      $5
   19    19        INIT_FCALL                                                   'var_export'
         20        SEND_VAR                                                     !1
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.03 ms | 1687 KiB | 14 Q