3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "19018216307,Public,\,k]'=system1-system2,20230914143505.5,1-050000,No"; $pattern = <<<'REGEX' ~(?nxx) (?# modifiers: - inline n: parenthesis act as non-capturing groups - inline xx: spaces are ignored even in character classes - global A: all the matches have to be contiguous ) # pattern ( (?!\A) , \K | \A ) # not at the start with a commas or at the start without [^ , \\ ]* ( \\ . [^ , \\ ]* )* # field content (all that isn't a comma nor # a backslash, or an escaped character) # check ( \z (*:END) )? # define a marker if the end of the string is reached ~A REGEX; if (preg_match_all($pattern, $str, $m) && isset($m['MARK'])) { $result = array_map(fn($s) => strtr($s, ['\\\\' => '\\', '\\' => '']), $m[0]); print_r($result); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/WHOMg
function name:  (null)
number of ops:  22
compiled vars:  !0 = $str, !1 = $pattern, !2 = $m, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '19018216307%2CPublic%2C%5C%2Ck%5D%27%3Dsystem1-system2%2C20230914143505.5%2C1-050000%2CNo'
    5     1        ASSIGN                                                   !1, '%7E%28%3Fnxx%29%0A++++%28%3F%23+modifiers%3A%0A++++++++-+inline+n%3A+parenthesis+act+as+non-capturing+groups%0A++++++++-+inline+xx%3A+spaces+are+ignored+even+in+character+classes%0A++++++++-+global+A%3A+all+the+matches+have+to+be+contiguous%0A++++%29%0A%0A++++%23+pattern%0A++++%28+%28%3F%21%5CA%29+%2C+%5CK+%7C+%5CA+%29+%23+not+at+the+start+with+a+commas+or+at+the+start+without%0A++++%5B%5E+%2C+%5C%5C+%5D%2A+%28+%5C%5C+.+%5B%5E+%2C+%5C%5C+%5D%2A+%29%2A+%23+field+content+%28all+that+isn%27t+a+comma+nor%0A++++++++++++++++++++++++++++++++++++%23+a+backslash%2C+or+an+escaped+character%29+%0A%0A++++%23+check%0A++++%28+%5Cz+%28%2A%3AEND%29+%29%3F+%23+define+a+marker+if+the+end+of+the+string+is+reached%0A%7EA'
   23     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $6      
          7      > JMPZ_EX                                          ~7      $6, ->10
          8    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !2, 'MARK'
          9        BOOL                                             ~7      ~8
         10    > > JMPZ                                                     ~7, ->21
   24    11    >   INIT_FCALL                                               'array_map'
         12        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         13        SEND_VAL                                                 ~9
         14        FETCH_DIM_R                                      ~10     !2, 0
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !3, $11
   25    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                                 
   26    21    > > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WHOMg
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.73 ms | 1013 KiB | 17 Q