3v4l.org

run code in 300+ 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}
number of ops:  9
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 ''
          4        FETCH_DIM_R                                      ~1      !0, 1
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
    9     8*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.88 ms | 1005 KiB | 15 Q