3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = '"hi (text here) and (other text)" come (again) and "(again)", right?'; echo preg_replace( '~(?:\G(?!^)|"(?=[^"]+"))[^"()]*(?:"(*SKIP)(*FAIL)|\K[()])~', '\\\$0', $str );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hcCCk
function name:  (null)
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%22hi+%28text+here%29+and+%28other+text%29%22+come+%28again%29+and+%22%28again%29%22%2C+right%3F'
    5     1        FRAMELESS_ICALL_3                preg_replace        ~2      '%7E%28%3F%3A%5CG%28%3F%21%5E%29%7C%22%28%3F%3D%5B%5E%22%5D%2B%22%29%29%5B%5E%22%28%29%5D%2A%28%3F%3A%22%28%2ASKIP%29%28%2AFAIL%29%7C%5CK%5B%28%29%5D%29%7E', '%5C%5C%240'
    8     2        OP_DATA                                                      !0
          3        ECHO                                                         ~2
    9     4      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.73 ms | 2003 KiB | 13 Q