3v4l.org

run code in 300+ 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:  8
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        INIT_FCALL                                               'preg_replace'
    6     2        SEND_VAL                                                 '%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'
    7     3        SEND_VAL                                                 '%5C%5C%240'
    8     4        SEND_VAR                                                 !0
    5     5        DO_ICALL                                         $2      
    8     6        ECHO                                                     $2
    9     7      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.99 ms | 996 KiB | 14 Q