3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array["\r\nNo quotation marks:\r\n"] = 'Column1|Column2|Column3|Column4'; $array["\r\nQuotation marks on every column:\r\n"] = '"Column1"|"Column2"|"Column3"|"Column4"'; $array["\r\nQuotation marks on first column only:\r\n"] = '"Column1"|Column2|Column3|Column4'; $array["\r\nQuotation marks on last column only:\r\n"] = 'Column1|Column2|Column3|"Column4"'; $array["\r\nQuotation marks around empty first column:\r\n"] = '""|Column2|Column3|Column4'; $array["\r\nQuotation marks around empty middle column:\r\n"] = 'Column1|""|Column3|Column4'; $array["\r\nQuotation marks around empty last column:\r\n"] = 'Column1|Column2|Column3|""'; $array["\r\nUnescaped quotation marks:\r\n"] = '"Column"1""|Column2|Column3|Column4'; $array["\r\nEscaped quotation marks:\r\n"] = '"Column\"1\""|Column2|Column3|Column4'; $delimiter = '\\|'; $enclosure = '"'; foreach($array as $id => $row){ echo $id; echo $row."\r\n"; $row = preg_replace("/(?:(?<=^|{$delimiter}){$enclosure})|(?:{$enclosure}(?=$|{$delimiter}))/",'',$row); echo $row."\r\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 41
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 41
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/jJV8i
function name:  (null)
number of ops:  43
compiled vars:  !0 = $array, !1 = $delimiter, !2 = $enclosure, !3 = $row, !4 = $id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                                   !0, '%0D%0ANo+quotation+marks%3A%0D%0A'
          1        OP_DATA                                                      'Column1%7CColumn2%7CColumn3%7CColumn4'
    4     2        ASSIGN_DIM                                                   !0, '%0D%0AQuotation+marks+on+every+column%3A%0D%0A'
          3        OP_DATA                                                      '%22Column1%22%7C%22Column2%22%7C%22Column3%22%7C%22Column4%22'
    5     4        ASSIGN_DIM                                                   !0, '%0D%0AQuotation+marks+on+first+column+only%3A%0D%0A'
          5        OP_DATA                                                      '%22Column1%22%7CColumn2%7CColumn3%7CColumn4'
    6     6        ASSIGN_DIM                                                   !0, '%0D%0AQuotation+marks+on+last+column+only%3A%0D%0A'
          7        OP_DATA                                                      'Column1%7CColumn2%7CColumn3%7C%22Column4%22'
    7     8        ASSIGN_DIM                                                   !0, '%0D%0AQuotation+marks+around+empty+first+column%3A%0D%0A'
          9        OP_DATA                                                      '%22%22%7CColumn2%7CColumn3%7CColumn4'
    8    10        ASSIGN_DIM                                                   !0, '%0D%0AQuotation+marks+around+empty+middle+column%3A%0D%0A'
         11        OP_DATA                                                      'Column1%7C%22%22%7CColumn3%7CColumn4'
    9    12        ASSIGN_DIM                                                   !0, '%0D%0AQuotation+marks+around+empty+last+column%3A%0D%0A'
         13        OP_DATA                                                      'Column1%7CColumn2%7CColumn3%7C%22%22'
   10    14        ASSIGN_DIM                                                   !0, '%0D%0AUnescaped+quotation+marks%3A%0D%0A'
         15        OP_DATA                                                      '%22Column%221%22%22%7CColumn2%7CColumn3%7CColumn4'
   11    16        ASSIGN_DIM                                                   !0, '%0D%0AEscaped+quotation+marks%3A%0D%0A'
         17        OP_DATA                                                      '%22Column%5C%221%5C%22%22%7CColumn2%7CColumn3%7CColumn4'
   13    18        ASSIGN                                                       !1, '%5C%7C'
   14    19        ASSIGN                                                       !2, '%22'
   16    20      > FE_RESET_R                                           $16     !0, ->41
         21    > > FE_FETCH_R                                           ~17     $16, !3, ->41
         22    >   ASSIGN                                                       !4, ~17
   17    23        ECHO                                                         !4
   18    24        CONCAT                                               ~19     !3, '%0D%0A'
         25        ECHO                                                         ~19
   19    26        ROPE_INIT                                         9  ~21     '%2F%28%3F%3A%28%3F%3C%3D%5E%7C'
         27        ROPE_ADD                                          1  ~21     ~21, !1
         28        ROPE_ADD                                          2  ~21     ~21, '%29'
         29        ROPE_ADD                                          3  ~21     ~21, !2
         30        ROPE_ADD                                          4  ~21     ~21, '%29%7C%28%3F%3A'
         31        ROPE_ADD                                          5  ~21     ~21, !2
         32        ROPE_ADD                                          6  ~21     ~21, '%28%3F%3D%24%7C'
         33        ROPE_ADD                                          7  ~21     ~21, !1
         34        ROPE_END                                          8  ~20     ~21, '%29%29%2F'
         35        FRAMELESS_ICALL_3                preg_replace        ~26     ~20, ''
         36        OP_DATA                                                      !3
         37        ASSIGN                                                       !3, ~26
   20    38        CONCAT                                               ~28     !3, '%0D%0A'
         39        ECHO                                                         ~28
   16    40      > JMP                                                          ->21
         41    >   FE_FREE                                                      $16
   21    42      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.05 ms | 2587 KiB | 13 Q