3v4l.org

run code in 500+ PHP versions simultaneously
<?php $txt = "My text \"can contain\" both single 'and double\"' quotes. The quotes \"can also be 'nested\" as you can see."; if (preg_match_all('~(?|"([^"]*)"|\'([^\']*)\')~', $txt, $matches)) { print_r($matches[1]); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/RtMXf
function name:  (null)
number of ops:  12
compiled vars:  !0 = $txt, !1 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'My+text+%22can+contain%22+both+single+%27and+double%22%27+quotes.+The+quotes+%22can+also+be+%27nested%22+as+you+can+see.'
    4     1        INIT_FCALL                                                   'preg_match_all'
          2        SEND_VAL                                                     '%7E%28%3F%7C%22%28%5B%5E%22%5D%2A%29%22%7C%27%28%5B%5E%27%5D%2A%29%27%29%7E'
          3        SEND_VAR                                                     !0
          4        SEND_REF                                                     !1
          5        DO_ICALL                                             $3      
          6      > JMPZ                                                         $3, ->11
    5     7    >   INIT_FCALL                                                   'print_r'
          8        FETCH_DIM_R                                          ~4      !1, 1
          9        SEND_VAL                                                     ~4
         10        DO_ICALL                                                     
    6    11    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.45 ms | 2299 KiB | 15 Q