3v4l.org

run code in 300+ 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 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/BrnW7
function name:  (null)
number of ops:  26
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, ->21
          3    > > FE_FETCH_R                                               $5, !2, ->21
   15     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%2F%2C%5Cd%2A%24%2F'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $7      
          8      > JMPZ                                                     $7, ->14
   16     9    >   INIT_ARRAY                                       ~8      !2, 'input'
         10        ADD_ARRAY_ELEMENT                                ~8      '.', 'thousands'
         11        ADD_ARRAY_ELEMENT                                ~8      '%2C', 'decimal'
         12        QM_ASSIGN                                        ~9      ~8
         13      > JMP                                                      ->18
   17    14    >   INIT_ARRAY                                       ~10     !2, 'input'
         15        ADD_ARRAY_ELEMENT                                ~10     '%2C', 'thousands'
         16        ADD_ARRAY_ELEMENT                                ~10     '.', 'decimal'
         17        QM_ASSIGN                                        ~9      ~10
   15    18    >   ASSIGN_DIM                                               !1
   17    19        OP_DATA                                                  ~9
   14    20      > JMP                                                      ->3
         21    >   FE_FREE                                                  $5
   19    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.57 ms | 1000 KiB | 15 Q