3v4l.org

run code in 500+ PHP versions simultaneously
<?php $csvFileOld = "pre text appears here....,\"\"key\n\n words\r\n appear\r\n here\"\",....post text appears here"; //line break always appears between the final 2 quotation marks $csvFileNew = preg_replace_callback('`,""(.*?)",`s', function($matches) { return str_replace(array("\r", "\n"), '', $matches[1]); },$csvFileOld); echo $csvFileNew;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNKSV
function name:  (null)
number of ops:  10
compiled vars:  !0 = $csvFileOld, !1 = $csvFileNew
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'pre+text+appears+here....%2C%22%22key%0A%0A+words%0D%0A+appear%0D%0A+here%22%22%2C....post+text+appears+here'
    6     1        INIT_FCALL                                                   'preg_replace_callback'
          2        SEND_VAL                                                     '%60%2C%22%22%28.%2A%3F%29%22%2C%60s'
          3        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
    9     4        SEND_VAL                                                     ~3
          5        SEND_VAR                                                     !0
    6     6        DO_ICALL                                             $4      
          7        ASSIGN                                                       !1, $4
   10     8        ECHO                                                         !1
   11     9      > 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/FNKSV
function name:  {closure:/in/FNKSV:6}
number of ops:  6
compiled vars:  !0 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    8     1        FETCH_DIM_R                                          ~1      !0, 1
          2        FRAMELESS_ICALL_3                str_replace         ~2      <array>, ''
          3        OP_DATA                                                      ~1
          4      > RETURN                                                       ~2
    9     5*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.75 ms | 1865 KiB | 14 Q