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', ]; foreach ($tests as $test) { [$int, $sep, $dec] = preg_split('/.*\K([.,])/', $test, 3, PREG_SPLIT_DELIM_CAPTURE); var_dump($test, $int, $sep, $dec); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 24
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/BhbDr
function name:  (null)
number of ops:  26
compiled vars:  !0 = $tests, !1 = $test, !2 = $int, !3 = $sep, !4 = $dec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   13     1      > FE_RESET_R                                       $6      !0, ->24
          2    > > FE_FETCH_R                                               $6, !1, ->24
   14     3    >   INIT_FCALL                                               'preg_split'
          4        SEND_VAL                                                 '%2F.%2A%5CK%28%5B.%2C%5D%29%2F'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 3
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $7      
          9        FETCH_LIST_R                                     $8      $7, 0
         10        ASSIGN                                                   !2, $8
         11        FETCH_LIST_R                                     $10     $7, 1
         12        ASSIGN                                                   !3, $10
         13        FETCH_LIST_R                                     $12     $7, 2
         14        ASSIGN                                                   !4, $12
         15        FREE                                                     $7
   15    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !3
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                                 
   16    22        ECHO                                                     '%0A'
   13    23      > JMP                                                      ->2
         24    >   FE_FREE                                                  $6
   17    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.44 ms | 999 KiB | 15 Q