3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "\"Test\"", "'Test'", "`Test`", "(Test)", "Test\"", "'Test", "Test`", "(Test", "\"Test'", "'Test\"", "`Test", "Test)", ]; $pattern = '/(?|(["\'`])(Test)\1|\(((Test)\)))/'; foreach ($strings as $string){ $isMatch = preg_match($pattern, $string, $matches); if ($isMatch) { echo "Match $string ==> " . $matches[2] . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/OUQAH
function name:  (null)
number of ops:  21
compiled vars:  !0 = $strings, !1 = $pattern, !2 = $string, !3 = $isMatch, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, '%2F%28%3F%7C%28%5B%22%27%60%5D%29%28Test%29%5C1%7C%5C%28%28%28Test%29%5C%29%29%29%2F'
   18     2      > FE_RESET_R                                       $7      !0, ->19
          3    > > FE_FETCH_R                                               $7, !2, ->19
   19     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !4
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   20    10      > JMPZ                                                     !3, ->18
   21    11    >   ROPE_INIT                                     3  ~11     'Match+'
         12        ROPE_ADD                                      1  ~11     ~11, !2
         13        ROPE_END                                      2  ~10     ~11, '+%3D%3D%3E+'
         14        FETCH_DIM_R                                      ~13     !4, 2
         15        CONCAT                                           ~14     ~10, ~13
         16        CONCAT                                           ~15     ~14, '%0A'
         17        ECHO                                                     ~15
   18    18    > > JMP                                                      ->3
         19    >   FE_FREE                                                  $7
   23    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.11 ms | 1010 KiB | 14 Q